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?
- Moving Average - Trend Indicators - Technical Indicators - Price Charts, Technical and Fundamental Analysis
- Moving Average - Trend Indicators - Indicators - Charts - MetaTrader 5 for Android
- Moving Average - Trend Indicators - Indicators - Chart - MetaTrader 5 for iPhone
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.
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:
Show your EA.
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?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register