the compare pic, red is MA indicator (origin one),yellow is mine (with iMa function )
the MA indicator line variable is same to iMa ( price is close price, sample ma, periord = 10 )
MA indicator setting
I use iMa function in my code, but I campare with indicator shipped with mt4, the value iMa computed is not right.
the code I use iMa is below:
while(i>=0) // Loop for uncounted bars
{
Buf_0[i]=iMA(NULL,0,MA_Period,0,MODE_SMMA,PRICE_CLOSE,i ); // Value of 0 buffer on i bar
i--; // Calculating index of the next bar
}
I think it should be SMA(CLOSE,10) .
but when put it compare with MA10(SIMPLE MA) indicator, they are so different .
did i do something wrong . any one help.
I think you should use MODE_SMA, not MODE_SMMA (smoothed average) in your call to the iMA function.
I think you should use MODE_SMA, not MODE_SMMA (smoothed average) in your call to the iMA function.
yes, I modified it to MODE_SMA, but still different
I think iMa maybe has bug,I must make sure I do not do something wrong first
- 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 use iMa function in my code, but I campare with indicator shipped with mt4, the value iMa computed is not right.
the code I use iMa is below:
while(i>=0) // Loop for uncounted bars
{
Buf_0[i]=iMA(NULL,0,MA_Period,0,MODE_SMA,PRICE_CLOSE,i ); // Value of 0 buffer on i bar
i--; // Calculating index of the next bar
}
I think it should be SMA(CLOSE,10) .
but when put it compare with MA10(SIMPLE MA) indicator, they are so different .
did i do something wrong . any one help.