Trade Signals Using Reversal Candlestick Patterns in MQL5

Trade Signals Using Reversal Candlestick Patterns in MQL5
Download ALL MT5 experts (1558)
YouTube Video Thumbnail



Similar MetaTrader Tools

Trade Signals Using Reversal Candlestick Patterns in MQL5

Info

The Trade Signals Using Reversal Candlestick Patterns in MQL5 is a Expert Advisor for MetaTrader 5 that this tool provides automatic creation of expert advisors using trade signals based on reversal candlestick patterns. The CSignalCandles class generates trade signals derived from reversal candlestick patterns.

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 Trade Signals Using Reversal Candlestick Patterns in MQL5

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 provides automatic creation of Expert Advisors using trade signals based on reversal candlestick patterns.

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 provides automatic creation of Expert Advisors using trade signals based on reversal candlestick patterns.

Also recommended: Quantum XAUUSD Silver Trader - similar expert with strong performance on MetaTrader 5.


The CSignalCandles class generates trade signals derived from reversal candlestick patterns. This strategy is known as "Signals based on reversal candlestick patterns" when creating an EA automatically in the MQL5 Wizard.

The core idea is to identify reversal patterns by calculating a composite candle. These patterns are analogous to the "Hammer" and "Hanging Man" patterns in Japanese candlestick analysis, but they utilize a composite candle instead of a single one and do not require a small body within the composite candle for reversal confirmation.

Input Parameters:

Range: The maximum number of bars used in the composite candle calculation.

Minimum: The minimum size of the composite candle in conventional points.

ShadowBig and ShadowSmall: Define the shadow sizes (in composite candle units).

Limit, StopLoss, and TakeProfit: These parameters set the open price, Stop Loss, and Take Profit levels, respectively. Their values are defined relative to the closing price of the composite candle (in composite candle units).

Expiration: The order expiration time in bars, used when trading with pending orders (when Limit is not 0.0).

Reversal Candlestick Pattern Determination:

The system calculates composite candle parameters starting from the most recent completed bar (index 1) up to the number of bars specified by the Range parameter. If the composite candle's size exceeds the value defined by the Minimum parameter, it checks for reversal conditions by analyzing its shadows.

The size of the upper shadow represents bearish power, while the size of the lower shadow represents bullish power.

To confirm a bearish trend reversal (indicating the start of a bullish trend), the lower shadow size (bullish power) must be greater than the value defined by ShadowBig, and the upper shadow size (bearish power) must be less than the value defined by ShadowSmall.

To confirm a bullish trend reversal (indicating the start of a bearish trend), the upper shadow size (bearish power) must be greater than the value defined by ShadowBig, and the lower shadow size (bullish power) must be less than the value defined by ShadowSmall.

Additional Trading Strategies:

Beyond the reversal strategy, breakdown strategies can be employed by setting a negative value for the Limit input parameter.

Depending on the Limit value, three distinct market entry methods are used:

- Limit > 0: Entry occurs on a price retracement, offering a better price than the market price. Buy Limit or Sell Limit pending orders are placed based on the trade signal.

- Limit < 0: Entry occurs in the direction of price movement. Buy Stop or Sell Stop pending orders are used based on the trade signal.

- Limit = 0: Trading is executed at market prices.

This strategy is implemented within the CSignalCandles class.

Figure 1. Trade signals based on reversal candlestick patterns

Trade Signal Implementation:

Trade signals are handled by the CSignalCandles class, which includes a Candle() function for analysis.

Multiple candles (bars) can contribute to the formation of a composite candle. The minimum number of bars is set by the Range parameter. In certain situations, a composite candle can be formed using fewer bars than specified by Range if the size and shadow conditions are met. The Candle() function returns 0 if a composite candle cannot be formed.

1. Opening a Long Position:
A bullish composite candle is required to open a long position. The function verifies this, returning if the composite candle is not yet formed or is bearish. Otherwise, it calculates the composite candle size (used for determining price, Stop Loss, and Take Profit levels) and computes the price levels for a pending order.
Note that the pending order type (Buy Limit or Buy Stop) depends on the sign of the Limit input parameter. If Limit is 0 or the absolute difference between price and ask is less than the stop level, a market buy order is placed. If Limit > 0, a Buy Limit pending order is placed. If Limit < 0, a Buy Stop pending order is placed.

2. Closing a Long Position:
A long position is closed when a bearish composite candle is formed.

3. Opening a Short Position:
A bearish composite candle must be formed to open a short position. If the composite candle is not formed or is not bearish, the function returns. Otherwise, it determines the composite candle's size and calculates the pending order price levels (the order type is determined by the sign of the Limit input parameter, as explained in "Opening a Long Position").

4. Closing a Short Position:
A short position is closed when a bullish composite candle is formed.

Creating an Expert Advisor using the MQL5 Wizard:

To create a trading robot based on this strategy, select the signal property as "Signals based on reversal candlestick patterns" within the "Creating Ready-Made Expert Advisors" option of the MQL5 Wizard.

Figure 2. Select "Signals based on reversal candlestick patterns" in MQL5 Wizard

Subsequently, specify the required algorithm and system. The Expert Advisor code will be generated automatically, allowing you to compile and test it within the MetaTrader 5 client terminal.

Testing Results:

Consider the backtesting of the Expert Advisor on historical data (EURUSD M15, testing period: 1.1.2010-05.01.2011, Range=3, Minimum=50, ShadowBig=0.5, ShadowSmall=0.2, Limit=0, StopLoss=2.0, TakeProfit=1.0, Expiration=4).

When creating the Expert Advisor, a fixed volume (0.1) was used, and the Trailing Stop algorithm was not employed.

Figure 3. Testing Results of the Expert Advisor with trading signals based on reversal candlestick patterns

Attachments:

The SignalCandles.mqh file, containing the CSignalCandles class, should be placed in the terminal_data_folder\MQL5\Include\Expert\Signal folder.
The expert_candles.mq5 file contains the code for the Expert Advisor, which was created using the MQL5 Wizard.

You may also like: Prime Quantum AI: AI-Powered Trading with MetaTrader 5 - excellent alternative for expert users on MetaTrader 5.


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.