Help on iMa

 

Hi


When I put MaShift = -3 in the iMA function as shown below, it returns 0 in my EA, when I change the MaShift = 0, it gives a proper reading, funny thing is in backtest, when I use MaShift = -3, the 2 Ma lines are properly showed on the chart windows, and it does shift to left by 3 bar, but the EA just returm 0 when I try to print out the value of fastMA and SlowMA. are zero


fastMA = iMA(NULL, 0, 10, -3, 1, 0, 0)

SlowMA = iMA(NULL, 0, 50, -3, 1, 0, 0)


Anyone can help..


Thanks


TT_FX1



 

You have a right kwirk here. The back tester makes assumptions so it may be correcting your mistake. For instance if you delete an indicator that the EA needs it will still run and assumes a value but the results are all wrong so forget the back tester for the moment.

Firstly the MA should shift to the right not the left when using negative numbers so is that what you want?

By using -3 you are asking the EA to predict the future. On a chart you can shift the MA forward to the right but the value it has at zero shift is the current MA value.

Please explain what you are trying to do.

Reason: