It is better to consult a doctor for fast relief. As mentioned above, following a healthy diet, healthy eating habits (avoiding too much of alcohol, caffeine, smoking, late nights, etc.), and regular exercises is the best and the easiest way to prevent hormone imbalance and head pains.