MQL5 Wizard: Trading Signals with Bullish/Bearish Meeting Lines and CCI
Info
The MQL5 Wizard: Trading Signals with Bullish/Bearish Meeting Lines and CCI is a Expert Advisor for MetaTrader 5 that this tool allows the creation of ready-made expert advisors (eas) based on classes provided with the client terminal. It enables quick testing of trading ideas by creating custom trading signal classes.
Usage
This tool is typically used for automated trading on major forex pairs and gold.
Platform
This Expert Advisor works exclusively on MetaTrader 5 (both build 600+ and newer versions).
Setup
Place the downloaded file in MQL5/Experts folder via File ? Open Data Folder in MetaTrader 5.
How to Install and Use MQL5 Wizard: Trading Signals with Bullish/Bearish Meeting Lines and CCI
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.
What this tool does
This tool allows the creation of ready-made Expert Advisors (EAs) based on classes provided with the client terminal.
Typical Use Case
This Expert Advisor excels in automated trading and technical analysis on MetaTrader 5.
Compatible Platform & Setup
This Expert Advisor works on MetaTrader 5. Place the file in the MQL5/Experts folder and restart the terminal.
Description & Settings
Related: automated trading with mq l5 wizard: crossover of two exponentially smoothed moving averages - another powerful expert for MetaTrader 5 traders.
This tool allows the creation of ready-made Expert Advisors (EAs) based on classes provided with the client terminal. It enables quick testing of trading ideas by creating custom trading signal classes. The structure and an example of these classes can be found in the provided documentation.Also recommended: trade signals using reversal candlestick patterns in mql5 - similar expert with strong performance on MetaTrader 5.
The core concept involves deriving a trading signal class from a base class, and then overriding specific virtual methods with custom logic.
A resource titled "(in Russian)" discusses various trading strategies. This guide focuses on reversal candlestick patterns, specifically "bullish/bearish meeting lines," confirmed by the Commodity Channel Index (CCI) and other oscillators.
It is recommended to create a separate class for identifying candlestick patterns. For trade signal confirmation, a class derived from CCandlestickPattern can be extended with additional features, such as oscillator confirmations.
This guide details signals based on "bullish/bearish meeting lines" reversal candlestick patterns confirmed by the CCI indicator. The trading signal module is based on a specific class, providing a simple example of its use for creating candlestick pattern-based trade signals.
1. Bullish/Bearish Meeting Lines Reversal Candlestick Patterns
1.1. Bullish Meeting Lines
This pattern consists of two candlesticks, a bearish followed by a bullish, with very close closing prices. The body size of both candlesticks should exceed the average body length. The "bullish meeting lines" pattern signals a potential reversal of a downtrend.
Figure 1 illustrates the "bullish meeting lines" pattern.
The recognition of this pattern is implemented in the CheckPatternBullishMeetingLines() method within its class. The CheckCandlestickPattern(CandlePatternBullishMeetingLines) method is used to verify the formation of this pattern.
1.2. Bearish Meeting Lines
This pattern consists of two candlesticks, a bullish followed by a bearish, with very close closing prices. The body size of both candlesticks should exceed the average body length. The "bearish meeting lines" pattern signals a potential reversal of a downtrend.
Figure 2 illustrates the "bearish meeting lines" pattern.
The recognition of this pattern is implemented in the CheckPatternBearishMeetingLines() method within its class. The CheckCandlestickPattern(CandlePatternBearishMeetingLines) method is used to verify the formation of this pattern.
2. Trade Signals Confirmed by CCI Indicator
Trading signals for opening long or short positions must be confirmed by the CCI indicator. The CCI value must be above critical levels (greater than -50 for long positions, greater than 50 for short positions).
Position closure depends on CCI values and can occur in two scenarios:
- If the CCI line reaches the opposite critical level (80 for long positions, -80 for short positions).
- If the reverse signal is not confirmed (when CCI reaches the following levels: -80 for long positions, 80 for short positions).
Figure 3 shows the "bullish meeting lines" pattern confirmed by the CCI indicator.
int CML_CCI::LongCondition() - Checks conditions for opening a long position (returns 80) and closing a short position (returns 40).
int CML_CCI::ShortCondition() - Checks conditions for opening a short position (returns 80) and closing a long position (returns 40).
2.1. Open Long Position / Close Short Position
The formation of the "bullish meeting lines" pattern must be confirmed by the indicator: CCI(1) < -50 (the CCI value of the last completed bar must be less than -50).
A short position should be closed if the indicator crosses upward the critical level -80 or downward the critical level 80.
2.2. Open Short Position / Close Long Position
The formation of the "bearish meeting lines" pattern must be confirmed by the indicator: CCI(1) > 50 (the CCI indicator value of the last completed bar must be greater than 50).
A long position should be closed if the indicator crosses downward the -80 level or upward the 80 level.
2.3. Creating an Expert Advisor Using the MQL5 Wizard
The CML_CCI class is not part of the standard library. To use it, download the acml_cci.mqh file (see attachments) and save it to the client_terminal_data\folder\mql5\include\expert\signal\mysignals directory. Do the same for the CandlePatterns.mqh file. You can then use them in the MQL5 Wizard after restarting MetaEditor.
To create an Expert Advisor, launch the MQL5 Wizard.
Figure 4 shows launching the MQL5 Wizard.
Specify the name of the Expert Advisor.
Figure 5 shows the general properties of the Expert Advisor.
Next, select the trade signal modules to be used.
Figure 6 shows the signal properties of the Expert Advisor.
In this case, we will use only one trade signal module.
Add the "Signals based on bullish/bearish meeting lines confirmed by CCI" module of trading signals.
Figure 7 shows adding the signal module.
The trade signal module has been added.
Figure 8 shows the added signal module.
You can select any trailing properties, but we will use "Trailing stop not used".
Figure 9 shows the trailing properties.
Regarding money management properties, we will use "Trading with fixed trade volume".
Figure 10 shows the money management properties.
By clicking the "Finish" button, the generated Expert Advisor code will be created in the expert_aml_cci.mq5 file and saved in the terminal_data_folder\mql5\experts\ directory.
The default input parameters of the generated Expert Advisor:
Must be replaced with:
The signal_thresholdopen and signal_thresholdclose input parameters allow specifying threshold levels for opening and closing positions.
In the code of the LongCondition() and ShortCondition() methods of the trade signals class, fixed threshold values were set:
- Open position: 80
- Close position: 40
The Expert Advisor generated by the MQL5 Wizard opens and closes positions using "votes" from the trade signal modules. The vote of the main module (as a container for all added modules) is also used, but its LongCondition() and ShortCondition() methods always return 0.
The vote results of the main module are also used in "votes" averaging. In this case, with a main module plus one trade signal module, this must be accounted for when setting threshold values. Therefore, the thresholdopen and thresholdclose must be set to 40=(0+80)/2 and 20=(0+40)/2, respectively.
The values of the signal_stoplevel and signal_takelevel input parameters are set to 0, indicating that positions will be closed only when the closing conditions are met.
2.4. History Backtesting Results
Let's examine the backtesting results of the Expert Advisor on historical data (EURUSD H1, testing period: 2000.01.01-2011.03.16, PeriodCCI=18, MA_Period=3).
When creating the Expert Advisor, a fixed volume (0.1) was used, and the trailing stop algorithm was not employed.
Figure 11 shows the testing results of the Expert Advisor based on Bullish/Bearish Meeting Lines + CCI.
The optimal set of input parameters can be found using the Strategy Tester within the MetaTrader 5 client terminal.
The code for the Expert Advisor created by the MQL5 Wizard is attached as expert_aml_cci.mq5.
You may also like: mql5 wizard: trade signals with dark cloud cover/piercing line and rsi confirmation - excellent alternative for expert users on MetaTrader 5.
Source Code
#property copyright "robotfx"
#property link "https://robotfx.org"
#property version "1.00"
#include <expert\expert.mqh>
#include <expert\signal\mysignals\acml_cci.mqh>
#include <expert\trailing\trailingnone.mqh>
#include <expert\money\moneyfixedlot.mqh>
input string expert_title ="expert_aml_cci"; // document name
ulong expert_magicnumber =26331; //
bool expert_everytick =false; //
.......
⚠ Limitations & Risk Warning
- This tool is provided for educational and testing purposes only.
- Past performance does not guarantee future results.
- Trading involves substantial risk of loss. Use on a demo account first.
- Results may vary depending on market conditions, broker, and settings.
- We recommend thorough backtesting and forward testing before using with real funds.