Exponential Moving Average Error

To add comments, please log in or register
mcokeke
10
mcokeke  

Help please.

I have calculated the average price using an exponential moving average on 5 min time frame. Where sym is the chart symbol because I am trading multiple charts with an EA attached to a chart. See below.

map = iMA(sym,5,3,0,MODE_EMA,PRICE_MEDIAN,0);

The values are different from the values shown by MT4 EMA for the same period and time frame. For some symbols, they are close. The difference is more on USDJPY. Why is that? 

William Roeder
20207
William Roeder  
The parameters used must be different.
mcokeke
10
mcokeke  

No. The same parameters. See below.



Keith Watford
Moderator
20336
Keith Watford  
map = iMA(sym,5,3,0,MODE_EMA,PRICE_MEDIAN,0);

You are checking the current bar which is constantly changing.

By the time you get the value and then check against the indicator, the value may have changed.

To add comments, please log in or register