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
Keith Watford:
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
thannks, but have you read the the codes closely? there are two differences, please re-read.
selnomeria:
thannks, but have you read the the codes closely? there are two differences, please re-read.
thannks, but have you read the the codes closely? there are two differences, please re-read.
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.
selnomeria: why does offset exists at all, as we can just put i+2 in index?
|
|
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
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?