Indicator Negative Shift

 
Hi.

It´s possible to shift a iMA with negative values but using the iMA function?

The standard MA of MT let you shift into negative.

Setting SMA 20, shift -10 you obtain a 20 MA delayed by 10 days.

But apply this to iMA seems to no work .

According with the sets I suppose the code should be:
Buffer[i]=iMA(NULL,0,20,-10,MODE_SMMA,PRICE_CLOSE,i);

Is that right?

Thanks.
 
Shift is the last parameter, i. Change that to i-10.
 
ThomasB, this is another shift. But ma_shift -10 with shift 0 is equal to ma shift 0 with shift -10

Linuxuser, last possible value for ma_shift=-10 is on the shift 10 from current bar. Values from 9-0 are undefined
 
Hello :)

Thanks for the answers.

Maybe my explanation was not good at all. I´m trader not programmer :)

So, I´m posting a screen of in what I´m working, which is W Bressert theories (10 is the half of 20. If the dominant cicle is 20 period, the MA is plotting on the half of the cycle).

The SMA on chart is 20, displaced -10. The SMA in window 1 it´s the same.

The second window is a modified MACD code to explanation purposes:

for(int i=0; i<limit; i++)
MacdBuffer[i]=iMA(NULL,0,FastEMA,0,MODE_SMA,PRICE_CLOSE,i);

However, using i+10 or FastEMA,-10.... I can make the SMA will be plotted as in window 1

If I can do that, a series of displaced indicators can be made.

IE: we have a DPO, DPO(i) = Close(i) - SMA(i, N) . Apply the displaced MA a Centered Dentrended Price Oscillator can be made.
Reason: