iMA shift

 

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.

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 

 
acepsut:

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 

 
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?

iMA() does not plot anything . . .  it returns a value,  what bar do you want the value for ?  this is shift,  the bar number.
 
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]
 
  1. 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.
  2. for a sma that would be [shift + period - 1, shift] (index gets larger in the past)
 
famedoro:
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]
RaptorUK:
 . . .  what bar do you want the value for ?  this is shift,  the bar number.



period  -  Averaging period for calculation.
 
WHRoeder:
  1. 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.
  2. 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?
 
famedoro:
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

 
WHRoeder:

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


Thanks for your very helpful response, now it's clear to me. But using Period=10 shouldn't you take Sum(2,3..11) and Sum(3,4..12) instead of Sum(1,2..11), Sum(2,3..12) ?
Reason: