Download MetaTrader 5

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

To add comments, please log in or register
Articles can help you to solidify your knowledge. Come and read them!
mnatarajan63
213
mnatarajan63 2011.10.18 04:55 

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

qjol
3243
qjol 2011.10.18 05:16  
whroeder1
14532
whroeder1 2011.10.18 12:56  
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.

Tjipke de Vries
6316
Tjipke de Vries 2011.10.18 13:58  


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

qjol
3243
qjol 2011.10.18 14:03  
"Previous Indicator's data" = iMAOnArray()
mnatarajan63
213
mnatarajan63 2011.10.18 15:33  

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

mnatarajan63
213
mnatarajan63 2011.10.18 15:34  

qjol
3243
qjol 2011.10.18 15:51  
maybe i didn't explain myself clear the first MA u use iMA() & the second MA u use iMAOnArray()
Simon Gniadkowski
Moderator
18001
Simon Gniadkowski 2011.10.18 15:54  
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 . .
mnatarajan63
213
mnatarajan63 2011.10.18 16:03  

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

qjol
3243
qjol 2011.10.18 16:10  
   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);
12
To add comments, please log in or register