MQ L5 Wizard: Trade Signals with Bullish/Bearish Engulfing and Stochastic Confirmation
Info
The MQ L5 Wizard: Trade Signals with Bullish/Bearish Engulfing and Stochastic Confirmation 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 MQ L5 Wizard: Trade Signals with Bullish/Bearish Engulfing and Stochastic 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 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: KS Q Command Center: Remote Trade Management for MetaTrader 5 - 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 such a class can be found in the associated article. The fundamental concept involves deriving a trading signal class from a base class, and then overriding specific virtual methods to implement custom logic.Also recommended: Quantum XAUUSD Silver Trader - similar expert with strong performance on MetaTrader 5.
For detailed trading strategies, consult the book "Trading Systems" (in Russian). This guide focuses on reversal candlestick patterns, specifically confirmed by the Stochastic indicator.
It is recommended to create a separate class derived from the base class for identifying candlestick patterns. To confirm trade signals generated by these patterns, you can extend a class derived from CCandlePattern by adding features like oscillator confirmation.
This document details signals based on the "Bullish Engulfing" and "Bearish Engulfing" reversal candlestick patterns, confirmed by the Stochastic indicator. The trade signal module is built upon a base class, providing a simple example for creating trade signals using candlestick patterns.
Bullish Engulfing and Bearish Engulfing Reversal Candlestick Patterns
Bullish Engulfing
The "Bullish Engulfing" reversal pattern occurs in a downtrend. It is characterized by a small black candlestick followed by a large white candlestick that completely engulfs the previous day's candlestick. The shadows of the small candlestick are short, allowing the body of the large candlestick to cover the entire previous day's candle.
The recognition of the "Bullish Engulfing" pattern is handled by the CheckPatternBullishEngulfing() method within its class.
Bearish Engulfing
The "Bearish Engulfing" reversal pattern forms in an uptrend. It consists of a small white candlestick followed by a large black candlestick that completely engulfs the previous day's candlestick. Similar to the bullish pattern, the shadows of the small candlestick are short, enabling the larger candlestick's body to cover the previous day's entire candle.
The recognition of the "Bearish Engulfing" pattern is implemented in the CheckPatternBearishEngulfing() method of its class.
Trade Signals Confirmed by Stochastic Indicator
Trading signals for opening long or short positions require confirmation from an oscillator. Specifically, the %D line of the Stochastic indicator must be above a certain critical level (e.g., 70 for short signals) or below another (e.g., 30 for long signals).
Closing opened positions depends on the %D indicator values. A position can be closed in two scenarios:
1. The %D line reaches the opposite critical level (e.g., 80 for a long position or 20 for a short position).
2. A reverse signal is not confirmed (e.g., the %D line reaches 20 for a long position or 80 for a short position).
The logic for checking trade conditions for entry and exit is implemented in two methods:
- int CBE_BE_Stoch::LongCondition(): Checks conditions to open a long position (returns 80) and close a short position (returns 40).
- int CBE_BE_Stoch::ShortCondition(): Checks conditions to open a short position (returns 80) and close a long position (returns 40).
Open Long Position/Close Short Position
The formation of a "Bullish Engulfing" pattern must be confirmed by the Stochastic indicator: StochSignal(1) < 30 (the signal line value of the Stochastic indicator on the last completed bar must be less than 30).
A short position should be closed if the indicator's signal line has crossed upward through the 20 or 80 levels.
Open Short Position/Close Long Position
The formation of a "Bearish Engulfing" pattern must be confirmed by the Stochastic indicator: StochSignal(1) > 70 (the signal line value of the Stochastic indicator on the last completed bar must be greater than 70).
A long position should be closed if the indicator's signal line has crossed downward through the 80 or 20 levels.
Creating an Expert Advisor Using the MQL5 Wizard
The CBE_BE_Stoch class is not part of the Standard Library. To use it, download the acbe_be_stoch.mqh file (refer to attachments) and save it in the client_terminal_data_folder\MQL5\Include\Expert\Signal\MySignals folder. Do the same for the candlepatterns.mqh file. You can then use these files in the MQL5 Wizard after restarting the MetaEditor.
To create an Expert Advisor, launch the MQL5 Wizard.
Specify the name for your Expert Advisor.
Next, select the trading signal modules to be used.
In this scenario, we are using only one trading signal module.
Add the "Signals based on Bullish Engulfing/Bearish Engulfing confirmed by Stochastic" trading signal module.
The trading signal module has been added.
You can choose any trailing properties; for this example, we will use "Trailing Stop not used".
Regarding money management properties, we will use "Trading with fixed trade volume".
By clicking the "Finish" button, the Expert Advisor code will be generated and saved as Expert_ABE_BE_Stoch.mq5 in the terminal_data_folder\MQL5\Experts\ folder.
The default input parameters for the generated Expert Advisor should be adjusted as follows:
The Signal_ThresholdOpen and Signal_ThresholdClose input parameters control the threshold levels for opening and closing positions.
In the code of the LongCondition() and ShortCondition() methods of the trade signals class, fixed threshold values are set:
- 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 is also considered, but its LongCondition() and ShortCondition() methods return 0. The main module's vote results are used in averaging votes. In this case, with the main module plus one trade signal module, the threshold values must account for this. Therefore, ThresholdOpen should be set to 40 (calculated as (0+80)/2) and ThresholdClose to 20 (calculated as (0+40)/2).
The Signal_StopLevel and Signal_TakeLevel input parameters are set to 0, meaning positions will only be closed when the specified closing conditions are met.
History Backtesting Results
This section presents backtesting results of the Expert Advisor on historical data (EURUSD H1, testing period: 2010.01.01-2011.03.04, PeriodK=47, PeriodD=9, PeriodSlow=13, MA_period=5).
The Expert Advisor was created using a fixed volume (0.1) and without using a Trailing Stop algorithm.
The optimal set of input parameters can be determined using the Strategy Tester within the MetaTrader 5 client terminal.
The code for the Expert Advisor generated by the MQL5 Wizard is attached as expert_abe_be_stoch.mq5.
You may also like: Prime Quantum AI: AI-Powered Trading with MetaTrader 5 - excellent alternative for expert users on MetaTrader 5.
⚠ 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.