MA OF ANOTHER INDICATOR

 

Pls help me write a string of code to calculate the MA of an indicator.

This is what I have tried so far:


for (int a=0; a< MA_Period; a++)

double CCI = iCCI(NULL, 0, CCI_Period, PRICE_CLOSE, Current + a);

double MA_of_CCI=iMAOnArray(array[CCI], 0, MA_Period, 0, Ma_Method, 0) ;

or

double MA_of_CCI=iMAOnArray( double array[], int total, int period, int ma_shift, int ma_method, int shift) ;

But it could not be compiled. Pls help.


TP

 

look at the code for the macd as an example how to use iMAOnArray()

you need two indicator loops, the first one to fill a buffer with the values of the other indicator, then the second loop to put that buffer into iMAOnArray() so to draw the line

Reason: