I wrote a simple indicator to show an alert when price breaks out of either the high or the low of the previous day's candle or the previous H4 candle.
It seems to compile Ok but the problem is, every time I close and then restart MT4 the indicator disappears.
I've shown the code below (I know it's not all that good but I not a programmer!). Any help would be very much appreciated.
Regards
Paul
externbool ActiveAlert=true;
externbool DaySearchOn=true;
externbool H4SearchOn=true;
//+------------------------------------------------------------------+//| Custom indicator initialization function |//+------------------------------------------------------------------+int init()
{
//---- indicators//----return(0);
}
//+------------------------------------------------------------------+//| Custom indicator deinitialization function |//+------------------------------------------------------------------+int deinit()
{
//----//----return(0);
}
//+------------------------------------------------------------------+//| Custom indicator iteration function |//+------------------------------------------------------------------+int start()
{
int counted_bars=IndicatorCounted();
//----double Yesterday_High=iHigh(NULL,PERIOD_D1,1);
double Yesterday_Low=iLow(NULL,PERIOD_D1,1);
double Last_H4_High=iHigh(NULL,PERIOD_H4,1);
double Last_H4_Low=iLow(NULL,PERIOD_H4,1);
double current_bar_close=iClose(NULL,PERIOD_M1,0);
//==================================================================================if (DaySearchOn && current_bar_close>=(Yesterday_High))
if (DaySearchOn && current_bar_close<=(Yesterday_Low))
if (H4SearchOn && current_bar_close>=(Last_H4_High))
if (H4SearchOn && current_bar_close<=(Last_H4_Low))
{
if (ActiveAlert) Alert (Symbol()," ",Period());
}
//===================================================================================Comment("\nYesterday's High = ",Yesterday_High," Yesterday's Low = ",Yesterday_Low," Last H4 High = ",Last_H4_High," Last H4 Low = ",Last_H4_Low," Current Bar Close = ",current_bar_close);
//----return(0);
}
//+------------------------------------------------------------------+
Hi
I wrote a simple indicator to show an alert when price breaks out of either the high or the low of the previous day's candle or the previous H4 candle.
It seems to compile Ok but the problem is, every time I close and then restart MT4 the indicator disappears.
I've shown the code below (I know it's not all that good but I not a programmer!). Any help would be very much appreciated.
Regards
Paul