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 am a newbie learning to write EA. here are the problem, can any one help?
My logic is when MA3 more than MA8, then buy. when MA3 less than MA8, then sell. below is the code.I base on hourly chart.
douMA3Current = iMA(NULL,0,3,0,MODE_EMA,PRICE_CLOSE,0);
douMA3Previous = iMA(NULL,0,3,0,MODE_EMA,PRICE_CLOSE,1);
douMA8Current = iMA(NULL,0,8,0,MODE_EMA,PRICE_CLOSE,0);
douMA8Previous = iMA(NULL,0,8,0,MODE_EMA,PRICE_CLOSE,1);
sendMessage(StringConcatenate("ma3C ",DoubleToStr(douMA3Current,4)," ma8C ",DoubleToStr(douMA8Current,4),"ma3P ",DoubleToStr(douMA3Previous,4)," ma8P ",DoubleToStr(douMA8Previous,4)));
booBuy = (douMA3Current > douMA8Current && douMA3Previous < douMA8Previous);
I can get accurate Previous MA price, but my Current MA price is different from the chart. Can any one help?
Thank you
Fxcheong