can anyone tell me what's difference between:
iMA(NULL, 0, MY_LENGTH, 2, MODE_EMA, PRICE_LOW, i);
iMA(NULL, 0, MY_LENGTH, 0, MODE_EMA, PRICE_LOW, i+2);
dont they return the same value?
why does offset exists at all, as we can just put i+2 in index?
In the first, you are retrieving the MA value for bar index i
In the 2nd you are getting the value from 2 bars earlier
This would be for when you require the values for both i and I+2
Oh I see, I didn't notice the 1st MA is shifted 2.
Yes, they should return the same.
I guess that if you are using a shifted EA on your chart, it makes it less likely to make an error in your code if you have the shift in the iMA call.