-
Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
General rules and best pratices of the Forum. - General - MQL5 programming forum (2019)
Messages Editor -
al=iMA(Symbol(),PERIOD_CURRENT,200,0,MODE_SMMA,PRICE_CLOSE,0) using the Close value.
SMMA is not the mean, SMA is. -
Never any reason to use the SMMA(L) it's equivalent to the EMA(2L-1).
The Smoothed Moving Average or SMMA - How to Avoid It - NinjaTrader Programming | futures.io (March 23rd 2019)
Many thanks, and sorry for the editing... :-) All my best, Marco

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
Hi everybody, I am new here just enjoying MQL....
I am referring to Metatrader4 Release 4.00 (Mac).
I noted an incongruence between the Mean value at 200 period as evaluated programmatically using the iMA function
and that evaluated by the Moving Average Indicator on the graph.
Of course I am referring to the "Trend>Moving Average" Indicator who is reporting at time[0] on the Graph a value which
is different from iMA(Symbol(),PERIOD_CURRENT,200,0,MODE_SMMA,PRICE_CLOSE,0) .
If I am not wrong I suppose the call for the Simple Mean at 200 period is
val=iMA(Symbol(),PERIOD_CURRENT,200,0,MODE_SMMA,PRICE_CLOSE,0) using the Close value.
In my test the value obtained is not corresponding to that on the Indicator over the Graph, in this case 1782.66
iMa is returning instead a value of val=1780.35
On the Graph the value at the same bar is different.
Just to be clear: I used also Close[1] verifying the same incongruence at the previous bar.
Just to be more precise: I wrote the simple debug Function meanCloseValueOverPeiod(200) obtaining the Right value
as on the Graph. iMA gives however a different wrong value respect to the Indicator's Graph and also to the debug function.
Is there a Call Mistake? I just checked carefully the iMA parameters and of course I am
using the same Symbol and TimeFrame as on the Graph.
Here is the Debug function:
The Version (OS/Mac) I used is:
Metatrader4 Version 4.00 Build 1350
14 Oct. 2021