mql5 wizard: trade signals with bullish/bearish harami and stochastic confirmation

mql5 wizard: trade signals with bullish/bearish harami and stochastic confirmation
Download ALL MT5 experts (1593)
YouTube Video Thumbnail



Similar MetaTrader Tools

mql5 wizard: trade signals with bullish/bearish harami and stochastic confirmation

Info

The mql5 wizard: trade signals with bullish/bearish harami and stochastic confirmation is a Expert Advisor for MetaTrader 5 that this tool facilitates the creation of ready-made expert advisors (eas) using the classes provided with the client terminal. it enables rapid testing of trading ideas by allowing 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: trade signals with bullish/bearish harami 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 facilitates the creation of ready-made expert advisors (eas) using the 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 facilitates the creation of ready-made expert advisors (eas) using the classes provided with the client terminal. it enables rapid testing of trading ideas by allowing users to create their own trading signal classes.

Also recommended: trade signals using reversal candlestick patterns in mql5 - similar expert with strong performance on MetaTrader 5.


the fundamental concept involves deriving a trading signal class from a base class and then overriding specific virtual methods with custom implementations.

for trading strategies, this guide focuses on reversal candlestick patterns, specifically the bullish harami and bearish harami, confirmed by the stochastic indicator.

it is recommended to create a separate class derived from a candlestick pattern checking class to identify these patterns. for signal confirmation, another class derived from ccandlepattern can be created to incorporate oscillator confirmations.

this example details signals based on the "bullish harami/bearish harami" reversal candlestick pattern, confirmed by the stochastic indicator. the trading signal module is based on a class, demonstrating its use for generating signals from candlestick patterns.

bullish harami and bearish harami reversal candlestick patterns

bullish harami
the bullish harami reversal pattern occurs during a downtrend. it is characterized by a large candlestick followed by a smaller candlestick whose body is contained within the vertical range of the larger body. this pattern suggests a potential reversal of the downtrend, signaling an opportunity to enter a long position. the second candlestick typically opens with a gap up.
a smaller second (white) candlestick increases the likelihood of a reversal.
the recognition of the "bullish harami" pattern is implemented in the checkpatternbullishharami() method.
the checkcandlestickpattern(candle_pattern_bullish_harami) method is used to identify the formation of this pattern.

bearish harami
the bearish harami reversal pattern forms in an uptrend. it is indicated by a large candlestick followed by a smaller candlestick whose body is within the vertical range of the larger body. this pattern suggests a potential reversal of the uptrend, signaling an opportunity to enter a short position. the second candlestick typically opens with a gap down.
a smaller second (black) candlestick increases the likelihood of a reversal.
the recognition of the "bearish harami" pattern is implemented in the checkpatternbearishharami() method.
the checkcandlestickpattern(candle_pattern_bearish_harami) method is used to identify the formation of this pattern.

trade signals confirmed by stochastic indicator

trading signals for opening long or short positions require confirmation from an oscillator. the %d line of the stochastic indicator must be above a critical level (e.g., 70 for short signals) or below a critical level (e.g., 30 for long signals).

closing of opened positions is determined by the %d indicator values. positions can be closed in two scenarios:

1. the %d line reaches the opposite critical level (e.g., 80 for long positions, 20 for short positions).
2. a reverse signal is not confirmed (e.g., %d line reaches 20 for long positions, 80 for short positions).

checking trade conditions for entry and exit is handled by two methods:

int cbh_bh_stoch::longcondition() - checks conditions to open a long position (returns 80) and close a short position (returns 40).
int cbh_bh_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 harami" pattern must be confirmed by the stochastic indicator: stochsignal(1) < 30 (the signal line of the stochastic indicator for the last completed bar must be less than 30).

a short position should be closed if the indicator's signal line crosses above the 20 or 80 levels.

open short position / close long position

the formation of a "bearish harami" pattern must be confirmed by the stochastic indicator: stochsignal(1) > 70 (the signal line of the stochastic indicator for the last completed bar must be greater than 70).

a long position should be closed if the indicator's signal line crosses below the 80 or 20 levels.

creating an expert advisor using mql5 wizard

the cbh_bh_stoch class is not part of the standard library. to use it, download the acbh_bh_stoch.mqh file and save it to the client_terminal_data_folder\mql5\include\expert\mysignals directory. similarly, save the candlepatterns.mqh file. these can be used in the mql5 wizard after restarting the metaeditor.

to create an expert advisor, launch the mql5 wizard.

specify the name of the expert advisor.

select the trade signal modules to be used. in this case, only one module is used.

add the "signals based on bullish harami/bearish harami confirmed by stochastic" module.

trailing properties can be selected as desired; for this example, "trailing stop not used" is selected.

for money management properties, "trading with fixed trade volume" is used.

pressing "finish" generates the expert advisor code, saved as expert_abh_bh_stoch.mq5 in the terminal_data_folder\mql5\experts\.

the default input parameters of the generated expert advisor should be adjusted.

the signal_thresholdopen and signal_thresholdclose input parameters allow setting threshold levels for opening and closing positions. in the longcondition() and shortcondition() methods of the trade signal class, fixed threshold values are defined: 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 vote from the main module (a container for all added modules) is also used, but its longcondition() and shortcondition() methods return 0. the vote results of the main module are included in averaging. with one additional trade signal module, the thresholdopen and thresholdclose must be adjusted accordingly (e.g., 40 = (0+80)/2 and 20 = (0+40)/2).

the signal_stoplevel and signal_takelevel input parameters are set to 0, indicating that position closing occurs solely based on the defined closing conditions.

history backtesting results

backtesting was performed 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 a trailing stop algorithm was not employed.

the optimal set of input parameters can be identified using the strategy tester within the metatrader 5 client terminal.

the expert advisor code generated by the mql5 wizard is provided in expert_abh_bh_stoch.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\acbh_bh_stoch.mqh>
#include <expert\trailing\trailingnone.mqh>
#include <expert\money\moneyfixedlot.mqh>
input string         expert_title           ="test";      // document name
ulong                expert_magicnumber     =25842;       // 
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.