Download MetaTrader 5

Indicator buffers

To add comments, please log in or register
mpp
14
mpp  

Hi everyone,

I'm doing an Expert Advisor to trade in EUR/USD but I'm facing some dificulties. I don't understand very much how can I read values from indicator buffers (I read the explanation in the mql5 documentation but it is not clear for me). For example, how can I access the values from macd indicator, the main line and the signal line?

Here is what I have:

int macd = 0;

(...)

macd = iMACD("EURUSD", PERIOD_M30, 12, 26, 9,PRICE_CLOSE);

(...)

ArraySetAsSeries(_macd, true);

(...)

if (CopyBuffer(macd,0,0,20,_macd) < 0){Print("CopyBufferMA1 error =",GetLastError());}

(...)

Now how can I acess the value from the main line and the signal line of macd indicator from the current bar?

Thanks.

Best regards,

Rui

Documentation on MQL5: Standard Constants, Enumerations and Structures / Indicator Constants / Indicators Lines
  • www.mql5.com
Standard Constants, Enumerations and Structures / Indicator Constants / Indicators Lines - Documentation on MQL5
Rashid Umarov
Admin
11994
Rashid Umarov  
Have you seen the article How to call indicators in MQL5?

mpp
14
mpp  
Rosh:
Have you seen the article How to call indicators in MQL5?

Hello,

Thanks for your answer.

Yes I had seen that article but it doesn´t show how can I access the value from an indicator like macd that has 2 values.

Rashid Umarov
Admin
11994
Rashid Umarov  

Well, we have many articles. This is 20 Trade Signals in MQL5 where you can find several samples.
To add comments, please log in or register