mql5 wizard: trading signals with bullish/bearish engulfing and mfi confirmation

mql5 wizard: trading signals with bullish/bearish engulfing and mfi confirmation
Download ALL MT5 experts (1593)
YouTube Video Thumbnail



Similar MetaTrader Tools

mql5 wizard: trading signals with bullish/bearish engulfing and mfi confirmation

Info

The mql5 wizard: trading signals with bullish/bearish engulfing and mfi confirmation is a Expert Advisor for MetaTrader 5 that this tool allows the creation of ready-made expert advisors based on classes included with the client terminal. it facilitates rapid testing of trading ideas by enabling users to create their own 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 engulfing and mfi 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 based on classes included 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 based on classes included with the client terminal. it facilitates rapid testing of trading ideas by enabling users to create their own trading signal classes. the structure and examples for 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 the base class, and then overriding the virtual methods with custom logic.

for reference, a book titled "" (in russian) discusses numerous trading strategies. this guide focuses on reversal candlestick patterns confirmed by specific indicators and oscillators.

it is recommended to create a separate class derived from the base class for detecting candlestick patterns. to confirm trade signals generated by these patterns, a class derived from ccandlepattern can be created, incorporating additional features like oscillator confirmation.

this guide specifically examines signals based on the "bullish engulfing/bearish engulfing" reversal candlestick pattern, confirmed by the mfi indicator. the trading signal module is based on a class, providing a straightforward example of its use for creating signals 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 preceding day's candlestick. the shadows (tails) of the small candlestick are short, allowing the body of the large candlestick to cover the entire previous day's candle.

figure 1. "bullish engulfing" candlestick pattern

the detection of the "bullish engulfing" pattern is implemented in 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 preceding day's candlestick. the shadows (tails) of the small candlestick are short, enabling the body of the large candlestick to cover the entire previous day's candle.

figure 2. "bearish engulfing" candlestick pattern

the recognition of the "bearish engulfing" pattern is implemented in the checkpatternbearishengulfing() method of the class. the checkcandlestickpattern(candle_pattern_bearish_engulfing) method of the class is used to check for the formation of the "bearish engulfing" candlestick pattern.



trade signals confirmed by mfi indicator


trade signals for opening long or short positions must be confirmed by the mfi indicator. the mfi indicator value should be below 40 for long positions and above 60 for short positions.

the closure of open positions depends on the mfi indicator values and can occur in two scenarios:

- if the mfi has reached the opposite critical level (70 for long positions and 30 for short positions).
- if a reverse signal is not confirmed (when the mfi indicator reaches the following levels: 30 for long positions and 70 for short positions).

figure 3. "bullish engulfing" pattern confirmed by mfi indicator

int cbe_be_mfi::longcondition() - checks conditions to open a long position (returns 80) and close a short position (returns 40).

int cbe_be_mfi::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 mfi indicator: mfi(1)<40 (the mfi indicator value of the last completed bar must be less than 40).

a short position must be closed if the indicator has crossed upward past the critical levels (70 or 30).


open short position / close long position


the formation of a "bearish engulfing" pattern must be confirmed by the mfi indicator: mfi(1)>60 (the mfi indicator value of the last completed bar must be greater than 60).

a long position must be closed if the indicator has crossed upward past the critical levels (70 or 30).



creating an expert advisor using mql5 wizard


the cbe_be_mfi class is not included in the standard library classes. to use it, download the abe_be_mfi.mqh file (see attachments) and save it to the client_terminal_data_folder\mql5\include\expert\signal\mysignals. the same applies to the acandlepatterns.mqh file. these can be used in the mql5 wizard after restarting the metaeditor.

to create an expert advisor, launch the mql5 wizard.

figure 4. creating an expert advisor using mql5 wizard

specify the name of the expert advisor.

figure 5. general properties of the expert advisor

next, select the trading signal modules to be used.

figure 6. signal properties of the expert advisor

in this case, only one trading signal module is used.

adding the "signals based on bullish engulfing/bearish engulfing confirmed by mfi" module of trading signals.

figure 7. signal properties of the expert advisor

the trading signal module has been added.

figure 8. signal properties of the expert advisor

any trailing properties can be selected; however, "trailing stop not used" will be used here.

figure 9. trailing properties of the expert advisor

regarding money management properties, "trading with fixed trade volume" will be used.

figure 10. money management properties of the expert advisor

by clicking the "finish" button, the code for the generated expert advisor will be created and saved in terminal_data_folder\mql5\experts\ as expert_abe_be_mfi.mq5.

the default input parameters of the generated expert advisor:

must be replaced with:

the signal_thresholdopen and signal_thresholdclose input parameters allow for specifying threshold levels for opening and closing positions.

in the longcondition() and shortcondition() methods of the trading signals class, fixed threshold values have been 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 from the main module (acting 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 incorporated into the "votes" averaging. in this scenario, with the main module plus one trade signal module, this must be considered when setting threshold values. consequently, thresholdopen should be set to 40 ( (0+80)/2 ) and thresholdclose to 20 ( (0+40)/2 ).

the signal_stoplevel and signal_takelevel input parameters are set to 0, indicating that position closures will only occur when the closing conditions are met.



history backtesting results


backtesting of the expert advisor on historical data (eurusd h1, testing period: 2010.01.01-2011.03.16, periodmfi=37, ma_period=5) is examined.

during the expert advisor's creation, a fixed volume (0.1) was used, and the trailing stop algorithm was not employed.

figure 11. testing results of the expert advisor based on bullish engulfing / bearish engulfing + mfi

the optimal set of input parameters can be determined using the optimization tools within the metatrader 5 client terminal.

the code for the expert advisor, created by the mql5 wizard, is attached as expert_abe_be_mfi.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_mfi.mqh>
#include <expert\trailing\trailingnone.mqh>
#include <expert\money\moneyfixedlot.mqh>
input string expert_title         ="expert_abe_be_mfi"; // document name
ulong        expert_magicnumber   =19355;               // 
bool         expert_everytick     =false;               // 

.......

Leave your opinion, ask a question, share some knowledge

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.
© ROBOTFX Free educational tools by RobotFX. Use entirely at your own risk; we are not liable for any financial losses incurred.