Download MetaTrader 5

trying to capture values for EMA.5, EMA.10 and SMA.50 and SMA.100

To add comments, please log in or register
flwilliams87
207
flwilliams87 2015.06.27 19:22 
Looking to code an Expert Advisor that trades based on EMA.5 crossing over EMA.10 and/or SMA.50 crossing over SMA.100 but I am having problems trying to capture the different EMA and SMA values in my code.  Any suggestions?
Alexander Voronkov
19196
Alexander Voronkov 2015.06.27 19:55  
flwilliams87:
Looking to code an Expert Advisor that trades based on EMA.5 crossing over EMA.10 and/or SMA.50 crossing over SMA.100 but I am having problems trying to capture the different EMA and SMA values in my code.  Any suggestions?
Show your EA.
flwilliams87
207
flwilliams87 2015.06.29 05:08  
Alexander Voronkov:
Show your EA.

Code is below. I want to copy EMA5 and EMA10 into an array so that I can do a conidtional statement on whether EMA5 crosses above or below EMA10.


EM5_Handle=ima(Symbol(),5,0,MODE_EMA,PRICE_CLOSE;

EM10_Handle=ima(Symbol(),10,0,MODE_EMA,PRICE_CLOSE;


CopyBuffer(EMA5_Handle,MODE_EMA,0,9,EMA5_ARRAY);

CopyBuffer(EMA10_Handle,MODE_EMA,0,9,EMA10_ARRAY);


does the above look like it might work?

To add comments, please log in or register