Download MetaTrader 5

how to call MACD signal and main in my EA

To add comments, please log in or register
babigaf
15
babigaf  

I was going to write an EA based on MACD indicator.

I have problems with calling main and signal amounts in my EA. is there anybody able to give me a guide? 

Osama Shaban
1555
Osama Shaban  

The example in the MetaEditor help for iMACD function if fair enough to tell everything ...

Here it is ...

if(iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_MAIN,0)>iMACD(NULL,0,12,26,9,PRICE_CLOSE,MODE_SIGNAL,0)) return(0);

 Please let me know if anything is not clear.

babigaf
15
babigaf  

thanks Osama for help.

actually, I think these MODE_MAIN and MODE_SIGNAL supposed to be for MT4. in MT5 they come with (undeclared identifier).

and for the iMACD, it comes with: "wrong parameters count" error. 

or if there is something I need to call, I am afraid I don't know the path.

do you know what is the problem? 

Roberto Jacobs
48363
Roberto Jacobs  
babigaf:

thanks Osama for help.

actually, I think these MODE_MAIN and MODE_SIGNAL supposed to be for MT4. in MT5 they come with (undeclared identifier).

and for the iMACD, it comes with: "wrong parameters count" error. 

or if there is something I need to call, I am afraid I don't know the path.

do you know what is the problem? 

You can see an example in the folder:

MetaTrader5/MQL5/Experts/Advisors/ExpertMACD.mq5

or

MetaTrader5/MQL5/Experts/Examples/MACD/MACD Sample.mq5

To add comments, please log in or register