Donchian Channels TRADING STRATEGIES EA MT4/MT5 BACKTESTS & NEW OPTIMIZED SET FILES

Donchian Channels TRADING STRATEGIES EA MT4/MT5 BACKTESTS & NEW OPTIMIZED SET FILES

17 November 2024, 12:56
Biswarup Banerjee
0
313

Donchian Settings Documentation

The Donchian Channel is a popular technical indicator used to identify price breakouts, trends, and potential reversals. This Expert Advisor (EA) integrates the Donchian Channel to provide precise entry and exit strategies based on user-configured parameters.

The documentation covers indicator-related settings and references additional features available in the EA. The indicator-related settings focus on configuring the Donchian Channel. For advanced EA features such as hedging, grid recovery, and martingale strategies, refer to the .


MT4 Version is available here   Donchian Channels EA MT4

MT5 Version is available here   Donchian Channels EA MT5


1. Donchian Settings

Donchian Input Parameters

  • DONCHIAN1__TEXT_1 - Divider text for visual clarity in the input section. (Not used in calculations)
  • DONCHIAN1_TEXT - Label for Donchian 1 settings. (Not used in calculations)
  • DONCHIAN1__TEXT_2 - Divider text for visual clarity in the input section. (Not used in calculations)
  • InpTimeFrame - Specifies the timeframe for the Donchian Channel.
    • Options: Any valid timeframe (e.g., M1, H1, D1).
    • Default: PERIOD_CURRENT (uses the current chart timeframe).

Core Donchian Parameters

  • DonchianPeriod - The period used for calculating the upper and lower bands.
    • A larger period smooths the channel and captures broader trends.
    • Default: 20 .
  • Extremes - Specifies the type of extreme points for band calculation.
    • Options:
      • HIGH_LOW - Considers the high and low of the period.
      • HIGH_LOW_OPEN - Includes the opening price with the high and low.
      • HIGH_LOW_CLOSE - Includes the closing price with the high and low.
      • OPEN_HIGH_LOW - Considers the opening price, high, and low.
      • CLOSE_HIGH_LOW - Considers the closing price, high, and low.
    • Default: HIGH_LOW_CLOSE .
  • Margins - Defines additional margin in points for the channel.
    • Positive values expand the channel, while negative values contract it.
    • Default: -2 .
  • Shift - Shifts the Donchian Channel by the specified number of bars.
    • Default: 0 .

Entry Strategy Options

  • entryStrategy - Configures the entry strategy based on Donchian Channel signals.
    • Options:
      • ENTRY_STRATEGY1 - Buy when there’s a reversal at the lower band, sell at the upper band.
      • ENTRY_STRATEGY2 - Buy when the price crosses the upper band, sell when it crosses the lower band.
    • Default: ENTRY_STRATEGY1 .

Exit Strategy Options

  • exitStrategy - Configures the exit strategy based on Donchian Channel signals.
    • Options:
      • EXIT_STRATEGY1 - Buy exit on a reversal at the upper band, sell exit at the lower band.
      • EXIT_STRATEGY2 - Buy exit when the price crosses the lower band, sell exit when it crosses the upper band.
      • EXIT_STRATEGY3 - Exit (both buy and sell) when the price crosses the middle band.
      • EXIT_STRATEGY4 - Disable the exit strategy.
    • Default: EXIT_STRATEGY4 .

2. Additional Features

Moving Average (MA) Filter on Higher Timeframe

The MA filter enables trades that align with the broader trend based on a higher timeframe moving average:

  • Uptrend Condition - Allows buy trades when the close price is above the moving average.
  • Downtrend Condition - Allows sell trades when the close price is below the moving average.

Loss Recovery Strategies

There are couple of loss recovery strategies popular in the market. Grid, Hedge and Martingale is most popular among them. In this EA, we have these strategies inbuilt. But only one loss recovery strategy can be active at a time. EA will not load, if we enable more than one loss recovery strategies. There is one important point regarding these strategies, we can not set stoploss if you enable Grid or Hedge strategy. It will close trades earlier and will compromise the purpose of these strategies. All of these strategies are by default disabled.

Grid Recovery Strategy
In a losing position, the EA places additional trades in a grid pattern, averaging down the entry price to capitalize on retracements.
Hedge Strategy
To balance exposure during a losing position, the EA opens opposing trades (hedges), allowing profit potential in countertrend movements.
Martingale Strategy
Increases lot size after a loss on each subsequent signal, aiming for overall profitability.


Position Sizing Based on Profit
This feature adjusts the position size dynamically based on cumulative profit, aiming to optimize gains in favourable conditions. As profit accumulates, the EA increases the position size, allowing for scaled growth and larger potential returns.


Day Filter
Specifies trading days to avoid trading during specific days of the week, aligning with your strategy’s optimal market conditions. You can disable the entire day filter.


Time Filter
Limits trading to specific times, preventing trades during low-liquidity periods or other non-ideal market conditions. You can disable entire time filter.


This ADX-based EA, with versatile entry and exit strategies and advanced risk management features, is a comprehensive tool designed to adapt to various market conditions while offering robust control over trading operations. Use each feature thoughtfully to align with your trading objectives and risk management strategy.

 

3 .Backtests and Optimized Set files

The EA can be back tested with various different strategies with the help of different combinations of these options

  • Stop-Loss and Take-Profit
  • Single or Multiple Entry (Multiple entries is not suitable for Grid)
  • Entry Option
  • Exit Option (Not suitable for Grid, Hedge and Martingale) (Enable/Disable)
  • Time Filter (Enable/Disable)
  • Day Filter (Enable/Disable)
  • Breakeven (Enable/Disable)
  • Trailing Stop-Loss (Enable/Disable)
  • Daily, Weekly and Monthly Profit
  • Grid (Enable/Disable) with no stoploss
  • Hedge (Enable/Disable) with no stoploss
  • Martingale (Enable/Disable) with no stoploss
  • Higher timeframe Moving Average Trend Filter (Enable/Disable)

We have optimized our EA based on these different combinations in different timeframes (5Minute to 4 Hours). These optimizations are mainly performed on EURUSD, USDCHF, AUDUSD, GBPUSD, USDCAD, NZDUSD AND XAUUSD. We have run these optimizations on 4-10 years of data. You can find the optimized set files and results below.

Note: We have run the optimizations on every period calculation for faster results. In this approach calculation are perform on every candle loading. You can backtest on everytick mode, but backtest would be much slower. Optimization results may be different in different brokers. It depends on the mt5 data cache and specific broker data. Ideally mt5 has 99.99 tick quality data. For mt4 you need to purchase 99.99 quality data from specific providers. Each individual has their own preference of their settings and symbols. In case you need more optimized data you can always optimize yourself.

You can follow this video to learn how to optimize the EA.


Summary

The Donchian 1 settings offer robust configuration options for implementing trend-following or breakout strategies. By adjusting the period, margin, and extremes, users can customize the indicator for fast-moving markets or longer-term trends. Entry and exit strategies ensure flexibility for different trading styles, making the Donchian Channel a powerful tool in this EA.



You cand find the optimized set files for MT5 here