MQ L5 Wizard - Trade Signals Based on Crossover of Lines of the Alligator Indicator
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 Lines of the Alligator Indicator
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
provides the automatic creation of Expert Advisors (see ).
It's time consider the trading signals, based on the Alligator technical indicator, presented by B.Williams in "Trading Chaos". The strategy called
"Signals based on the Alligator"
(when creating EA automatically in MQL5 Wizard).
The system is based on three moving averages (Lips, Teeth and Jaw lines), and oscillators, calculated using the difference between them. The trading signals are generated after crossover of the Alligator lines, depending on trend, determined by order of these lines. In the case of upward trend the Lips line (with minimal period) is the highest, the next is the Teeth line, and the lowest is the Jaw line. The similar but opposite case in the case of downward trend.
The trade signals:
Open long position: crossover of the Alligator lines and increase of the distance between them in the case of the upward trend;
Close long position: upward crossover of Lips line with the Jaw line;
Open short position: crossover of the Alligator lines and increase of the distance between them in the case of the downward trend;
Close short position: downward crossover of Lips line with the Jaw line;
This strategy is implemented in CSignalAlligator class.
Figure 1. Trade signals, based on the Alligator technical indicator
Trade signals
The trading strategy is implemented in CSignalAlligator, it has some protected methods to simplify access to indicator values:
1. Open long position
The checking of trade conditions has some features, caused by the shift of the Lips, Teeth and Jaw lines.
Conditions to open long position:
The CheckCross is used to detemine the crossover and further increase of the difference between the lines;
LipsTeethDiff(-2)>=LipsTeethDiff(-1) and LipsTeethDiff(-1)>=LipsTeethDiff(0); check for increase of the difference between the Lips and Teeth lines;
LipsTeethDiff(0)>=0.0; the Lips line is higher than Teeth line;
TeethJawDiff(-2) >=TeethJawDiff(-1) and TeethJawDiff(-1) >=TeethJawDiff(0) ; check for increase of the difference between the Teeth and Jaw lines;
TeethJawDiff(0) >=0.0; the Teeth line is higher than Jaw line.
2. Close long position
Conditions to close liong position (note the shift of the lines):
LipsTeethDiff(-1)<0; the Lips line of the next bar (because of the shift) is lower than Teeth line;
LipsTeethDiff(0)>=0; the Lips line of the current bar is higher/equal than Teeth line;
LipsTeethDiff(1)>0; the Lips line of the previous (completed) bar is higher than Teeth line.
3. Open short position
Conditions to open short position:
The CheckCross is used to detemine the crossover and further increase of the difference between the lines;
LipsTeethDiff(-2)<=LipsTeethDiff(-1) and LipsTeethDiff(-1)<=LipsTeethDiff(0); check for increase of the difference between the Lips and Teeth lines;
LipsTeethDiff(0)<=0.0; the Lips line of the current bar is lower than Teeth line;
TeethJawDiff(-2)<=TeethJawDiff(-1) and TeethJawDiff(-1)<=TeethJawDiff(0); check for increase of the difference between the Teeth and Jaw lines;
TeethJawDiff(0) <=0.0; the Teeth line of the current bar is lower the Jaw line;
4. Close short position
Conditions to close short position:
LipsTeethDiff(-1)>0; the Lips line of the next bar (because of the shift) is higher than Teeth line;
LipsTeethDiff(0)<=0; the Lips line of the current bar is lower/equal then Teeth line;
LipsTeethDiff(1)<0; the Lips line of the previous (completed) bar is lower than Teeth line.
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 the Alligator
" in "Creating Ready-Made Expert Advisors" option of :
Figure 2. Select "Signals based on the Alligator" 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.
Testing Results
Let's consider backtesting of the Expert Advisor on historical data (EURUSD H1, testing period: 1.1.2010-05.01.2011, JawPeriod=13, JawShift=8, TeethPeriod=8, TeethShift=5, LipsPeriod=5, LipsShift=3, MaMethod=2, Applied=5, CrossMeasure=5).
In creation of Expert Advisor we used the fixed volume (, 0.1), Trailing Stop algorithm is not used ().
Figure 3. Testing Results of the Expert Advisor with trading signals, based on the Alligator indicator
The profit can be increased if you will use the deal filtration and take into account the market features, depending on time. The CSignalITF class will allow you to add the intraday time filter. The best times can be found using the of MetaTrader 5 client terminal. See example in .
Attachments:
The SignalAlligator.mqh with CSignalAlligator class must be placed to terminal_data_folder\MQL5\Include\Expert\Signal folder.
The expert_alligator.mq5 contains the code of the Expert Advisor, created using MQL5 Wizard.