difference between parameters "ma_shift" and "shift" in iMA(...) function

 
Is anybody able to explain me what is the difference between parameters "ma_shift" and "shift" in iMA(...) function? Its description in documentation is unsufficient to understand for me. Thanks.
 

Shift is which bar to start the period count from.. so 0 would be count back from the current bar, 1 count from last bar 2 bar before etc. Ma_shift is where to draw the line. You could set this to +10 (or it might be minus I can't remember) and have your line drawn in the future. My advise...experiment... what's the worst that could happen.

V

 
Viffer:

Shift is which bar to start the period count from.. so 0 would be count back from the current bar, 1 count from last bar 2 bar before etc. Ma_shift is where to draw the line. You could set this to +10 (or it might be minus I can't remember) and have your line drawn in the future. My advise...experiment... what's the worst that could happen.

V


Viffer,

Not that you are wrong, but this goes against my understanding of how shift and MA_shift works. I have been writing an EA to look to these two values as a crossover, and I have not had any luck in getting any response on backtesting.

I was thinking that by setting the MAs with virtually same variables at different shift intervals, the EA would be able to identify them (as I do visually) and act upon their change in position.

With that being said, how can you get an EA to look to the position of two MA's with virtually the same period timeframe, but with a different ma_shift (0 vs 2)? One idea I had come across was creating a custom indicator made up of a combined MA and time period. Any thoughts?

Thanks,

CountingMan

 
CountingMan:


Viffer,

Not that you are wrong, but this goes against my understanding of how shift and MA_shift works. I have been writing an EA to look to these two values as a crossover, and I have not had any luck in getting any response on backtesting.

I was thinking that by setting the MAs with virtually same variables at different shift intervals, the EA would be able to identify them (as I do visually) and act upon their change in position.

With that being said, how can you get an EA to look to the position of two MA's with virtually the same period timeframe, but with a different ma_shift (0 vs 2)? One idea I had come across was creating a custom indicator made up of a combined MA and time period. Any thoughts?

Thanks,

CountingMan

iMA(Symbol() bla bla bla bla, 0) > iMA(Symbol() bla bla bla bla, 2) && iMA(Symbol() bla bla bla bla, 1) <= iMA(Symbol() bla bla bla bla, 3) 
this should work for your ma ma-shift2 cross
 
zzuegg:
this should work for your ma ma-shift2 cross


zzuegg,

Thanks for the reply. I will try out your suggestion.

One last question: Must the two sets of MAs have different periods? In other words, can the all have say a period = 3, but with the differing shifts, or must two have say a period=3, and the other have a period = 4? The key difference will be that two will have an ma_shift of 0, and two will have an ma_shift of -2

Thanks again!

CountingMan

 

I thought shift was simply the index at which you want to calculate the MA. i.e. if shift = 2, it'll return the value of MA 2 bars ago. ma_shift, on the other hand moves the whole indicator to the right or the left.

If you're trying to look at recent values in an MA indicator, you'll want to use its "shift" as the variable index in your for loop.