How to bring Previous indicator data from moving average indicator to EA?

 

i am using EA, and i added Moving Average Indicator, now the applied price shows only PRICE_CLOSE to PRICE_WEIGHTED, but "Previous Indicator's data" is not available in the "stdlib". but it is available in metatrader.

How to bring this to EA??...can anyone help me sort this out??....thanks in advance....

 
 
kmnatarajan:
i am using EA, and i added Moving Average Indicator, now the applied price shows only PRICE_CLOSE to PRICE_WEIGHTED, but "Previous Indicator's data" is not available in the "stdlib". but it is available in metatrader.

iMA(..., 0) is the MA's current value.

iMA(..., 1) is the MA's value on the previous bar.

 


This is the average of the averages. So there has first been a calculation to get an average

On every bar there was a calculating to get a MA value

and then you take the average for let say 10 calculated MA values (or whatever you want)

Take the SUM of those and split it to 10 .......

 
"Previous Indicator's data" = iMAOnArray()
 

hmm.....am sorry mates.....i think i didnt explain myself correctly.... I need to use 2 Moving Average indicators, the first one taking up the data from the market value, and the latter using the former Moving Average's data....hope it explains...again thanks in advance....

 

 
maybe i didn't explain myself clear the first MA u use iMA() & the second MA u use iMAOnArray()
 
kmnatarajan:

hmm.....am sorry mates.....i think i didnt explain myself correctly.... I need to use 2 Moving Average indicators, the first one taking up the data from the market value, and the latter using the former Moving Average's data....hope it explains...again thanks in advance....

Store the MA result in an array, then you can get the MA of the data in the array using iMAOnArray . . as has been said already . .
 

Do you mean this iMAOnArray function will calculate the average of the Moving Average and store in it??.....then how do i use its values??....can someone post a code snippet pls??....am a learner....i dunno much about EA....thanks anyway for ur efforts dudes.....

 
   for(int i=0; i<limit; i++)
   First_MA[i] = iMA(NULL,0,20,0,MODE_SMA,PRICE_CLOSE,i);

   for(i=0; i<limit; i++)
   Second_MA[i]   = iMAOnArray(First_MA,0,14,0,MODE_SMA,i);
Reason: