if You use negative shift then current value (value from current bar is unreached yet and indefinite). last value in your case is in the 3-rd bar from current bar.
if You use negative shift then current value (value from current bar is unreached yet and indefinite). last value in your case is in the 3-rd bar from current bar.
Thank you for your fast replay.
Do you mean 3rd bar back from the current bar? Stange . . .
When I use terminal menu Insert / Indicators / Trend / Moving Average then I could fill the Shift box either with negative and positive number. Positive numbers move the MA line forward; negative - backword toward current bar. Shouldn't be the same when I use iMA from a script? It seems to me that this should be the case. Otherwise the biheiviour of a MA seems to me to be different when is used in script and when is used from the terminal interface, isn't it?
All the best
Ivo
Think about it, if you shift the ma line to the left (i.e. a negative shift) then there is no value for the '0' bar. Look at a chart and you will see, there is no line on the current bar. If you make shift equal to -5, there is no line for the 5 most recent bars.
Think through what you're saying.
The behaviour is the same.
Think through what you're saying.
The behaviour is the same.
When I use terminal menu Insert / Indicators / Trend / Moving Average then I could fill the Shift box either with negative and positive number. Positive numbers move the MA line forward; negative - backword toward current bar. Shouldn't be the same when I use iMA from a script?
the same. check with DataWindow
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
I found that it is inpossible to shift iMA with a negative number, nevertheless it MA works fine in wither cases when attached to the chart.
Here is the code and the log
Print("MA Shifted 3: " , iMA(NULL, 0, 14, 3, MODE_SMA, PRICE_CLOSE, 0));
result is:
15:03:52 2004.12.02 20:15 test1 USDCHF,M15: MA Shifted 3: 1.1472
Is it possible to use negative number as fourth parameter with iMA?
10x
Ivo