Differences in values, when using EA

 

I found differences in the outcome of MA,s written in an EA and the standard MA,s used as an indicator.

I wrote a symple EA that shows it.

The actual Open, Close, High and Low values are OK, the SMA10 on the High is OK, but the values of the SMA10 on the Open and the Close are not the same as the values of the indicator.

Has anybody else seen this?


Here is the formula:

int start()
{

double SMA10 = iMA(Symbol(),0,10,0,MODE_SMA,MODE_CLOSE,1);
double SMA10H = iMA(Symbol(),0,10,0,MODE_SMA,MODE_HIGH,1);
double SMA10L = iMA(Symbol(),0,10,0,MODE_SMA,MODE_LOW,1);

Comment("Figures of the last Closed Candle:",
"\n ","Open : ",Open[1],"\n ","High : ",High[1],"\n ","Low : ",Low[1],"\n ","Close : ",Close[1],
"\n ","Below the following Moving Averages:",
"\n ","SMA10 on the Close: ",SMA10,
"\n ","SMA10 on the High: ",SMA10H,
"\n ","SMA10 on the Low: ",SMA10L);

return(0);
}
 

Find the difference between MODE_CLOSE/OPEN/HIGH/LOW and corresponding PRICE_XXX values and use the proper (latter) ones.

Software developer ought to be pedantic. This is a pedantry test introdused by MQL4 creators. :)

Reason: