Is this a bug in MQL4?
No, that would have been seen and fixed years ago.
What indicator? What settings? Are you sure you are using period=10, EMA, on the close?
I don't see a problem:
Data window is MA10 set for EMA and Close. Comment is iMA value for 10 periods and Close Price
There can be discrepancies between tester and live chart with MAs of *very* long periods due to the fact that a backtest chart might not be initialized with enough bars before the start of the test. There was a discussion about this on FF a few months ago where someone used an EMA of 1000 bars. This showed different values in the backtest than in the live chart due to the way an exponential moving average is calculated. I can't remember exactly how easy it was to reproduce, some people tried it, some could not reproduce it and and some seemed to be able to reproduce it. It seemed to depend on the available history.

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
I noticed that the values returned by iMA for an EA are different from the ones shown on the graph by the corresponding indicator. I have written a small EA to test this:
I have done backtests on EURUSD, H4 and the values printed on the Alert statement differ from those on the indicator attached to the same chart. I also noticed the same behaviour with other indicators that are based on MAs like the MACD. Is this a bug in MQL4? If yes, is there a fix or way around it?
Thanks
Nikos