MQ L5 Wizard - Trade Signals Based on Crossover of Two Exponentially Smoothed Moving Averages
This is a powerful addition to your MetaTrader 5 toolkit designed to optimize market analysis and performance. This Expert Advisor serves as automated trading software. It is utilized to monitor financial markets and execute trades based on predefined algorithmic rules, enabling precise position management without the need for constant manual oversight.
How to Setup and Use MQ L5 Wizard - Trade Signals Based on Crossover of Two Exponentially Smoothed Moving Averages
1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.
2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.
3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.
4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.
Frequently Asked Questions
Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.
Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.
Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.
Description & Settings
allows to create the code of Expert Advisors automatically. See for the details.
Here we will consider the strategy based on crossover of two exponentially smoothed Moving Averages (fast EMA and slow EMA). The strategy called
"Signals based on crossover of two EMA"
(when creating EA automatically in MQL5 Wizard).
The trade signals:
Buy: the Fast EMA crossovers upward the slow EMA
Sell: the Fast EMA crossovers downward the slow EMA
This strategy is implemented in CSignalCrossEMA class.
Figure 1. Trade signals, based on crossover of two exponentially smoothed moving averages
Trade Signals
The trading strategy is implemented in CSignalCrossEMA class, it has some protected methods to simplify access to indicator values:
1. Open long position
Conditions to open long position:
StateEMA(1)>0 and StateEMA(2)<0: the Fast EMA has crossovered upward the slow EMA on the last completed bar.
2. Close long position
Conditions to close long position:
StateEMA(1)<0 and StateEMA(2)>0: the Fast EMA has crossovered downward the slow EMA on the last completed bar.
3. Open short position
The conditions to open short position are the same as long position closing conditions.
4. Close short position
The conditions to close short position are the same as long position opening conditions.
Creating Expert Advisor using MQL5 Wizard
To create a trading robot based on the strategy you need to choose the signal properties as "
Signals based on crossover of two EMA
" in "Creating Ready-Made Expert Advisors" option of :
Figure 2. Choose "Signals, based on crossover of two EMA" in MQL5 Wizard
The next you have to specify the needed algorithm and system. The code of Expert Advisor will be created automatically, you can compile it and test in of MetaTrader 5 client terminal.
In addition, the Standard library classes contains the "
Signals based on crossover of two MA
", implemented in the CSignalCrossMA class. The trading idea is similar, but it provides many additional features (specify types, shifts and averaging methods and use of Take Profit and Stop Loss levels).
Figure 3. "Signals, based on crossover of two MA" in MQL5 Wizard
Testing Results
Let's consider backtesting of the Expert Advisor on historical data (EURUSD H1, testing period: 1.1.2010-05.01.2011, FastPeriod=12, SlowPeriod=24).
In creation of Expert Advisor we used the fixed volume (, 0.1), Trailing Stop algorithm is not used ().
Figure 4. Historical backtesting results of the Expert Advisor, based on crossover of two EMA
Attachments:
The SignalCrossEMA.mqh with CSignalCrossEMA class must be paced to terminal_data_folder\MQL5\Include\Expert\Signal folder.
The crossover_2ema.mq5 contains the code of the Expert Advisor, created using MQL5 Wizard.