I wonder if someone could be so kind to clearly explain me about iMA shift: the doc about shift says:
shift | - | Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago). |
It is clear to me about ma_shift, but I still can't understand the reason for shift, even after have read other topic on this forum about shift.
ma_shift
shift is the bar that you want the MA value for . . . do you want the value of the MA for bar 0, bar 10, bar 100 ?
For MA_shift == 0
Hi RaptorUK and WHRoeder,
thank you very very much for your kind picture and replies: I understand ma_shift is like a grab and move left or right ( this is very useful for Hurst cycles application since Hurst approach use to displace mov avg for FLD).
So shift is like as ma_shift: I should have a mov avg plotted on 0 bar (last bar) if I set ma_shift = -8 and shift = 8; is it correct?
And if so, why have two shift as parameters?
Regards,
acepsut
Hi RaptorUK and WHRoeder,
thank you very very much for your kind picture and replies: I understand ma_shift is like a grab and move left or right ( this is very useful for Hurst cycles application since Hurst approach use to displace mov avg for FLD).
So shift is like as ma_shift: I should have a mov avg plotted on 0 bar (last bar) if I set ma_shift = -8 and shift = 8; is it correct?
- Unless you are plotting the MA on a chart and want it moved left or right from where it should be - ignore ma_shift, keep it zero.
- for a sma that would be [shift + period - 1, shift] (index gets larger in the past)
I'm also trying to understand the difference between shift and ma_shift, I think that shift indicates the range of values on which to calculate the moving average, ie [shift-period, shift]
. . . what bar do you want the value for ? this is shift, the bar number.
period | - | Averaging period for calculation. |
- Unless you are plotting the MA on a chart and want it moved left or right from where it should be - ignore ma_shift, keep it zero.
- for a sma that would be [shift + period - 1, shift] (index gets larger in the past)
I'm really sorry, but I do not understand your answer refers to shift, can you give me an example that can help me?
I'm also trying to understand the difference between shift and ma_shift, I think that shift indicates the range of values on which to calculate the moving average, ie [shift-period, shift]
sma from bar 13 to bar 3 Period=10, shift=3
13 12 11 10 09 08 07 06 05 04 03 02 01 00
1 2 3 4 5 6 7 8 9 10 11 12 xx xx
Sum(1,2..11) = 66 sma = 6.6
Sum(2,3..12) = 77 sma = 7.7
iMA(NULL,0, 10, 0, MODE_SMA, PRICE_xxx, 3) would return 6.6
iMA(NULL,0, 10, 0, MODE_SMA, PRICE_xxx, 2) would return 7.7
sma from bar 13 to bar 3 Period=10, shift=3
13 12 11 10 09 08 07 06 05 04 03 02 01 00
1 2 3 4 5 6 7 8 9 10 11 12 xx xx
Sum(1,2..11) = 66 sma = 6.6
Sum(2,3..12) = 77 sma = 7.7
iMA(NULL,0, 10, 0, MODE_SMA, PRICE_xxx, 3) would return 6.6
iMA(NULL,0, 10, 0, MODE_SMA, PRICE_xxx, 2) would return 7.7
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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 wonder if someone could be so kind to clearly explain me about iMA shift: the doc about shift says:
It is clear to me about ma_shift, but I still can't understand the reason for shift, even after have read other topic on this forum about shift.
I have also plotted a simple mov avg but I only have ma_shift as parameter, so I can't figure out how this shift works.
Can anybody help me, taking as example a simple mov avg 10 periods on close and , if possibile, posting a picture with shift = 0 and shift = 5?
Thanks all!
acepsut