Using iMA for variables

 

I am trying to chart the moving average of a variable I have called "eqb"

Can I use the iMA to say:

double eqb;

ExtMapBuffer1[i]=iMA(NULL,0,35,0,MODE_SMMA,eqb,i);

What is the best way to do this without manually computing this?

 
iMaOnArray()
 
zzuegg:
iMaOnArray()

Thank you. I appreciate it.
 
Probably use iMAOnArray( double array[], int total, int period, int ma_shift, int ma_method, int shift) instead and store the eqb values in an array.
 
I tried to use iMAOnArray but wasn't sure about some of the values it uses . . for example, what does MA shift mean ? So I coded my own solution in the end . . .
 

The same as shift in all other indicators, it shifts back/forward the values for x bars.

Instead of using MA shift i assume you can also use (shift+MA shift). Never needed ma shift up to now. The xOnArray family behaves like it's original, but i suggest to use them in indicators in a separate loop, to be sure all variables the *OnArray() function accesses are initalized

 

So you're saying compute the numbers and then save that as an array? Then compute the moving average of the array?

 
What ever variable you want the MA of, put it into an array . .
Reason: