Thank you Slawa!
So, I can use both ma_shift and shift but in reverse signage. In other words in your above example, ma_shift=8 is the same as shift = -8, and vice versa.
correct?
So, I can use both ma_shift and shift but in reverse signage. In other words in your above example, ma_shift=8 is the same as shift = -8, and vice versa.
correct?
no. there are difference. "ma_shift" shifts moving average line relative to beginning of chart. "shift" is number of bar (from current bar) from wich You take ma_value. another example:
iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,0)
is the same
iMA(NULL,0,13,0,MODE_SMMA,PRICE_MEDIAN,8)
or
iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,-8)
is the same
iMA(NULL,0,13,0,MODE_SMMA,PRICE_MEDIAN,0)
you can check it
iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,0)
is the same
iMA(NULL,0,13,0,MODE_SMMA,PRICE_MEDIAN,8)
or
iMA(NULL,0,13,8,MODE_SMMA,PRICE_MEDIAN,-8)
is the same
iMA(NULL,0,13,0,MODE_SMMA,PRICE_MEDIAN,0)
you can check it

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 was wondering if anyone knows the difference between the following arguments for iMA: "ma_shift" vs "shift". All I want to do is to calculate the value for 9 bar Moving Averages for current bar, previous bar, and previous to previous bar. But I am not too sure whether I should use "ma_shift" or "shift". I would appreciate if someone can provide an explanation.
iMA is defined as follow:
double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)
ma_shift - MA shift. Indicators line offset relate to the chart by timeframe.
shift - Shift relative to the current bar (number of periods back), where the data should be taken from.
Thanks in advance