Download MetaTrader 5

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

To add comments, please log in or register
mnatarajan63
213
mnatarajan63  

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  
whroeder1
15299
whroeder1  
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
6360
Tjipke de Vries  


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  
"Previous Indicator's data" = iMAOnArray()
mnatarajan63
213
mnatarajan63  

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  

qjol
3243
qjol  
maybe i didn't explain myself clear the first MA u use iMA() & the second MA u use iMAOnArray()
Simon Gniadkowski
Moderator
18023
Simon Gniadkowski  
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  

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