iMA (moving average) use with a "non Standard" Time Frame

 

It seems that iMA will only return a non zero value using the "standard" time frames. Is there a way of returning a moving average price using time frames such as m10 etc.

Additionally, what is the purpose of the maShift input?

int MAperiods1 = 9;     
int timeFrame  = 10;
int iShift     = 0;
int maShift    = 8; // what is the purpose of this input?

double maPrice = iMA(Symbol(), timeFrame, MAperiods1, maShift, MODE_EMA,PRICE_CLOSE, iShift);
return(maPrice); // returns 0 except when timeFrame is a standard period eg 5 15 30 etc
 
in case you want to use non standard TF you have to create the TF first using offline chart

maShft in your code is shifting the MA what's the purpose ? You tell me why did you shift it !

 
qjol:
in case you want to use non standard TF you have to create the TF first using offline chart

maShft in your code is shifting the MA what's the purpose ? You tell me why did you shift it !

OK, did not realise that the non standard TF were only available in offline charts

As for the maShift, I simply used what was in the documentation example. As I stated, I do not understand the purpose of this input, or at least a reson for its possible use.

 
you saw the alligator indicator ?
 
rod178:

OK, did not realise that the non standard TF were only available in offline charts

As for the maShift, I simply used what was in the documentation example. As I stated, I do not understand the purpose of this input, or at least a reson for its possible use.


MA Shift 8 will shift the whole MA forward by 8 bars. Some find it useful.