Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hi,
I'm trying to modify HA indicator by adding EMA as another condition.
I need to arrow up on white candle and haHigh>EMA14 but it look seem EMA return incorrect value
I have try for long hours to find out but really could not see where I was wrong
for(i=pos; i<rates_total; i++)
{
haOpen=(ExtOpenBuffer[i-1]+ExtCloseBuffer[i-1])/2;
haClose=(open[i]+high[i]+low[i]+close[i])/4;
haHigh=MathMax(high[i],MathMax(haOpen,haClose));
haLow=MathMin(low[i],MathMin(haOpen,haClose));
EMA14 = iMA(NULL, 0, 14, 0, MODE_EMA, PRICE_CLOSE, i);
//Alert(EMA14+" i="+i);
if(haOpen<haClose)
{
ExtLowHighBuffer[i]=haLow;
ExtHighLowBuffer[i]=haHigh;
}
else
{
ExtLowHighBuffer[i]=haHigh;
ExtHighLowBuffer[i]=haLow;
}
ExtOpenBuffer[i]=haOpen;
ExtCloseBuffer[i]=haClose;
if(Close[i]>EMA14)
{
CrossUp[i] = EMA14;
}
}
Please advise
Thanks in advance