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

214

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....

3245

17094

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.

6433

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 .......

3245

"Previous Indicator's data" = iMAOnArray()
214

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....

214

3245

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

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 . .
214

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.....

3245

```   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);
```