ranxero: I have a strange/incorrect value or the Moving Average 21 which I do not understand:
my MA settings(both in side the EA and the indicator on the chart) are:
method: MODE_EMA
price: PRICE_CLOSE
shift: 0
period: 21
please see attached screen shot.
on the left, inside the gray rectangle(retrieved via iMA() function call), the MA value is shown as 112.00608 while the MA indicator(added to the chart) for the same candle is giving 111.984.
both MAs use the same settings as listed above.
where does this diference come from? or what do I have to do to get the identical values for the same candle?
Without looking at your code, we will not be able to know the problem! We can only speculate!
Hi Fernando,
thanks for your reply.
in the EA my code to retriece the ma-value is:
// this value is displayed in the gray rectangle besides "MA-21":
double val = iMA(Symbol(), 15, 21, 0, MODE_EMA, PRICE_CLOSE, 0);
it shows: 112.006...
the other value, inside the chart, is displayed when moving the mouse over the MA-line for the same candle.
how come they differ? the indicator in the chart uses the same settings as in my EA code
got it.sorry, my bad
I had set the wrong time frame inside the strategy testers's EA config
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have a strange/incorrect value or the Moving Average 21 which I do not understand:
my MA settings(both in side the EA and the indicator on the chart) are:
method: MODE_EMA
price: PRICE_CLOSE
shift: 0
period: 21
please see attached screen shot.
on the left, inside the gray rectangle(retrieved via iMA() function call), the MA value is shown as 112.00608 while the MA indicator(added to the chart) for the same candle is giving 111.984.
both MAs use the same settings as listed above.
where does this diference come from? or what do I have to do to get the identical values for the same candle?
thanks in advance.