mql5 wizard: expert advisors with bullish/bearish engulfing and cci confirmation
Info
The mql5 wizard: expert advisors with bullish/bearish engulfing and cci confirmation is a Expert Advisor for MetaTrader 5 that this tool enables the creation of ready-made expert advisors (eas) utilizing classes provided with the metatrader client terminal. it allows for rapid testing of trading ideas, requiring only the creation of a custom trading signals class.
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: expert advisors with bullish/bearish engulfing and cci confirmation
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 enables the creation of ready-made expert advisors (eas) utilizing classes provided with the metatrader 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 enables the creation of ready-made expert advisors (eas) utilizing classes provided with the metatrader client terminal. it allows for rapid testing of trading ideas, requiring only the creation of a custom trading signals class. the structure and an example of this class are detailed in the accompanying 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 custom trading signals class from a base class and overriding specific virtual methods with proprietary logic.
for reference, a book titled "" (in russian) explores numerous trading strategies. this guide focuses on reversal candlestick patterns, specifically confirmed by the commodity channel index (cci), moving average (ma), and other oscillators.
it is recommended to create a separate class derived from the base class for recognizing candlestick patterns. to confirm trade signals generated by these patterns, a class derived from ccandlepattern can be developed, incorporating additional confirmation features like oscillator readings.
this guide specifically examines signals based on the "bullish engulfing" and "bearish engulfing" reversal candlestick patterns, confirmed by the cci indicator. the trading signal module is built upon a class designed for this purpose, offering a straightforward example of its application with candlestick patterns.
bullish engulfing and bearish engulfing reversal candlestick patterns
bullish engulfing
the "bullish engulfing" reversal pattern emerges during a downtrend. it consists of a small black candlestick followed by a large white candlestick that completely engulfs the previous day's candlestick. the short shadows of the initial small candlestick allow the body of the larger white candlestick to fully cover it.
figure 1 depicts the "bullish engulfing" candlestick pattern.
the recognition of the "bullish engulfing" pattern is implemented within the checkpatternbullishengulfing() method of the class.
the checkcandlestickpattern(candle_pattern_bullish_engulfing) method of the class is utilized to verify the formation of the "bullish engulfing" candlestick pattern.
bearish engulfing
the "bearish engulfing" reversal pattern forms in an uptrend. it is characterized by a small white candlestick followed by a large black candlestick that completely engulfs the previous day's candlestick. similar to the bullish pattern, the short shadows of the initial white candlestick enable the body of the larger black candlestick to cover it entirely.
figure 2 illustrates the "bearish engulfing" candlestick pattern.
the recognition of the "bearish engulfing" pattern is implemented within the checkpatternbearishengulfing() method of the class.
the checkcandlestickpattern(candle_pattern_bearish_engulfing) method of the class is used to confirm the formation of the "bearish engulfing" candlestick pattern.
trade signals confirmed by cci indicator
trade signals for opening long or short positions require confirmation from the cci indicator. the cci value must exceed critical levels: greater than -50 for a long position and less than 50 for a short position.
the closing of an open position is triggered under the following conditions:
- the cci line reaches the opposite critical level (80 for long positions and -80 for short positions).
- a reverse signal is not confirmed (when cci reaches levels of -80 for long positions and 80 for short positions).
figure 3 shows the "bullish engulfing" pattern confirmed by the cci indicator.
the cbe_be_cci::longcondition() method checks conditions for opening a long position (returns 80) and closing a short position (returns 40).
the cbe_be_cci::shortcondition() method checks conditions for opening a short position (returns 80) and closing a long position (returns 40).
open long position/close short position
the formation of a "bullish engulfing" pattern must be confirmed by the cci indicator, with cci(1) < -50 (the cci value of the last completed bar must be less than -50).
a short position should be closed if the cci indicator crosses upward past the critical level of -80 or crosses downward past the critical level of 80.
open short position/close long position
the formation of a "bearish engulfing" pattern must be confirmed by the cci indicator, with cci(1) > 50 (the cci value of the last completed bar must be greater than 50).
a long position should be closed if the cci indicator crosses downward past -80 or crosses upward past 80.
creating an expert advisor using mql5 wizard
the cbe_be_cci class is not part of the standard library. to use it, download the acbe_be_cci.mqh file (available in attachments) and save it to the client_terminal_data_folder\mql5\include\expert\signal\mysignals directory. similarly, save the candlepatterns.mqh file to the same location. after restarting metaeditor, these files will be available for use in the mql5 wizard.
to create an expert advisor, launch the mql5 wizard.
figure 4 illustrates the process of creating an expert advisor using the mql5 wizard.
specify the desired name for the expert advisor.
figure 5 shows the general properties of the expert advisor.
next, select the trade signal modules to be used.
figure 6 displays the signal properties of the expert advisor.
in this example, only one trade signal module is utilized.
add the "signals based on bullish engulfing/bearish engulfing confirmed by cci" module.
figure 7 shows the signal properties of the expert advisor after adding the module.
figure 8 displays the trade signal module that has been added.
select any desired trailing properties. for this demonstration, "trailing stop not used" is chosen.
figure 9 presents the trailing properties of the expert advisor.
regarding money management, "trading with fixed trade volume" will be used.
figure 10 illustrates the money management properties of the expert advisor.
clicking the "finish" button will generate the expert advisor code, saved as expert_abe_be_cci.mq5 in the terminal_data_folder\mql5\experts directory.
the default input parameters for the generated expert advisor need adjustment. specifically, the signal_thresholdopen and signal_thresholdclose parameters allow for setting threshold levels for opening and closing positions.
the longcondition() and shortcondition() methods within the trade signals class define fixed threshold values:
- open position: 80
- close position: 40
the expert advisor, generated by the mql5 wizard, opens and closes positions based on "votes" from the trade signal modules. the main module's vote (acting as a container for all added modules) is also considered, though its longcondition() and shortcondition() methods return 0.
the vote results from the main module are incorporated into the averaging process. with the main module and one additional trade signal module, the threshold values must be adjusted accordingly. therefore, thresholdopen should be set to 40 (calculated as (0 + 80) / 2), and thresholdclose should be set to 20 (calculated as (0 + 40) / 2).
the signal_stoplevel and signal_takelevel input parameters are set to 0. this configuration ensures that positions are closed solely based on the fulfillment of closing conditions.
history backtesting results
this section details the backtesting of the expert advisor on historical data (eurusd h1, testing period: january 1, 2010 - march 16, 2011, period cci=49, ma_period=11).
during the expert advisor's creation, a fixed volume (0.1) was used, and the trailing stop algorithm was not applied.
figure 11 displays the testing results of the expert advisor based on bullish engulfing/bearish engulfing with cci confirmation.
the optimal set of input parameters can be identified using the optimization tools within the metatrader 5 client terminal.
the code for the expert advisor generated by the mql5 wizard is attached as expert_abe_be_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\acbe_be_cci.mqh>
#include <expert\trailing\trailingnone.mqh>
#include <expert\money\moneyfixedlot.mqh>
input string expert_title ="expert_abe_be_cci"; // document name
ulong expert_magicnumber =29251; //
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.