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
1 730

Complete User Documentation — MT4 & MT5

1. OVERVIEW

The Donchian Channel Strategy Multicurrency EA automates trading across multiple currency pairs from a single chart, using Donchian Channel breakouts and reversals. It calculates the upper, middle, and lower bands for each symbol you specify, then generates entry and exit signals based on price action relative to those bands. This EA solves the problem of manually tracking multiple pairs for Donchian setups — it watches everything at once and trades when your criteria are met, with built-in risk controls like ATR trailing stops and grid recovery.

Who Should Use It: Active forex traders who want to automate Donchian Channel strategies across several pairs without juggling multiple charts or manual monitoring.

Main Benefit: You get a single-chart, multi-pair trading engine that handles entry, exit, and risk management based on Donchian signals, freeing you to focus on strategy tuning rather than execution.


2. INPUT PARAMETERS & SETTINGS

This product shares a common set of general input settings with all Multi-Currency Scanner Dashboard products in this series. The following sections are covered in the common guide: General Settings (pairs list, dashboard colors, panel size), Timeframe Signal Settings (individual TF scan per symbol), Timeframe Confluence Settings (multi-TF confluence scan), and Alert Settings (popup, push notification, email). For full details refer to the Common Multi-Currency Scanner Dashboard Settings Guide. The sections below cover only the product-specific inputs unique to this product.

General Settings

These settings control how the EA displays virtual stop levels, manages group-level risk across all open positions, accounts for swap costs in profit calculations, and records trade history for backtesting analysis.

Setting Name Type Default Value Description Example
Chart lines for virtual SL/TP (never drawn during optimization) bool false When enabled, the EA draws horizontal lines on the chart showing where your hidden stop loss and take profit levels sit. Useful for visual confirmation during live trading, but the EA skips drawing during optimization runs to keep backtests fast. true — enable lines when testing live on a demo so you can see where virtual stops are placed.
Group Stoploss Amount double 0 Sets a maximum total loss in account currency across all open positions. Once the combined floating loss hits this value, the EA closes all trades. Leave at 0 to disable group-level stop loss. 50 — close all positions if total loss reaches $50 on a small account.
Include Swap charges in Profit bool true When true, swap (overnight interest) is factored into profit calculations for breakeven and trailing stop logic. Disable if you want those features to ignore swap costs and only consider pure price movement. false — disable for short-term scalping where swap isn't a major factor.
Enable history for backtests or optimization bool false When enabled, the EA records detailed trade history to the Experts tab during backtests and optimization runs. Useful for debugging or analyzing trade sequences, but slows down optimization. Keep disabled for faster runs unless you need the logs. true — enable when troubleshooting a specific trade logic issue in backtest.

ATR Trailing Stop Settings

These settings configure an adaptive trailing stop based on Average True Range, which adjusts the stop distance automatically as market volatility changes.

Setting Name Type Default Value Description Example
Use ATR Trailing Stop bool false Master switch for the ATR-based trailing stop. When enabled, the EA replaces the fixed breakeven/trailing logic with a dynamic stop that widens or tightens based on current volatility. Leave disabled if you prefer fixed stops. true — enable for volatile pairs like GBP/JPY where fixed stops get hit too often.
ATR Timeframe ENUM PERIOD_CURRENT Selects the timeframe used to calculate the ATR value for trailing stop adjustments. Using a higher timeframe (e.g., H4) gives a smoother, less reactive stop; the current chart timeframe makes it more responsive. PERIOD_H1 — use hourly ATR for a balance between sensitivity and noise reduction.
ATR Period int 14 Number of bars used to compute the ATR. A shorter period (e.g., 7) makes the stop react faster to recent volatility changes, while a longer period (e.g., 21) smooths out spikes. Standard 14 works for most pairs. 10 — use a shorter period for faster reaction on 15-minute charts.
Activation (ATR multiplier) double 2.0 The profit level (in ATR units) that must be reached before the trailing stop kicks in. For example, a value of 2.0 means the trade must be up by 2 ATR before trailing starts. Higher values delay activation for bigger trends. 1.5 — activate trailing earlier on a 5-minute scalping setup.
Trail distance (ATR multiplier) double 1.0 The initial stop distance behind the current price, measured in ATR units. A value of 1.0 places the stop one ATR away from price. Tighter values (0.5) risk early exits, wider values (2.0) give more room. 0.8 — tighter trail for fast-moving pairs like USD/JPY during news.
Trail increment (ATR multiplier) double 0.5 How much the stop moves each time price advances by the activation distance. A value of 0.5 means the stop tightens by half an ATR for each ATR of favorable movement. Higher values lock in profit faster. 1.0 — lock profit more aggressively on a trend-following strategy.

Grid Settings

This setting controls whether the EA attempts to recover losses from a grid of multiple positions by closing them all at a combined profit target.

Setting Name Type Default Value Description Example
Recover profit from all grid trades bool false When enabled, the EA tracks the total profit of all open positions for a symbol and closes them all when the combined profit reaches a positive value. Useful for recovering from a series of losing entries in a grid or martingale approach. true — enable if you run multiple entries on EURUSD and want to exit only when the net is positive.

Safeguard Settings

These backtesting-only filters let you set minimum performance thresholds — the EA will skip trades or stop running if profit, trade count, or activity fall below your defined limits.

Setting Name Type Default Value Description Example
Max Loss from initial balance [0: disable] double 0.0 If the account equity drops by this percentage from the starting balance, the EA stops opening new trades. Set to 20 for a 20% drawdown limit. Works live and in backtest. Disable with 0. 15 — stop trading if account drops 15% from initial balance during a losing streak.
Minimum Profit Percent [backtesting only] [0: disable] double 0 During optimization, the EA discards any run where the total profit percentage is below this value. Helps filter out mediocre parameter sets. Only applies in backtest/optimization mode. 5 — ignore any optimization result with less than 5% total profit.
Minimum Trades [backtesting only] [0: disable] double 0 Optimization runs with fewer trades than this number are rejected. Useful to avoid overfitting on a handful of lucky trades. Only active during backtesting. 30 — require at least 30 trades for a valid optimization result.
Max inactive days [backtesting only] [0: disable] int 0 If the EA goes this many days without opening a trade during a backtest, the run is considered invalid. Helps avoid parameter sets that rarely trade. Only applies in backtest mode. 10 — reject any backtest where no trade occurs for 10 consecutive days.

Donchian Settings

These are the core strategy parameters that define how the Donchian Channel is calculated and how entry and exit signals are generated from price action relative to the bands.

Setting Name Type Default Value Description Example
Time frame ENUM PERIOD_CURRENT Selects the timeframe on which the Donchian Channel is calculated. Use the current chart timeframe for consistency, or switch to a higher one (e.g., H4) for a broader view of support and resistance levels.

3. HOW IT WORKS

Core Calculation & Logic

This EA monitors multiple currency pairs from a single chart, calculating Donchian Channel upper, middle, and lower bands for each symbol independently. It uses the highest high and lowest low over a user-defined period (default 20 bars) to construct these bands, then compares current price action against them to generate trading signals. The core logic evaluates two distinct entry strategies — reversal at the bands or breakout through them — and applies your chosen stop-loss and take-profit rules before executing trades automatically.

What sets this EA apart from a simple indicator scanner is that it actually places and manages trades. It tracks open positions per symbol, applies hidden or visible SL/TP levels, and supports group-level risk controls across all pairs. The technical basis is straightforward Donchian Channel theory, but the implementation adds practical layers: margin-based position sizing, multiple SL/TP calculation modes, and the ability to run on any timeframe while scanning across your entire symbol list.

Entry Strategies Explained

Strategy 1: Reversal at Channel Extremes

BUY Signal: Price touches or crosses below the lower Donchian band, then reverses and closes back above it. The EA checks that the close price is above the lower band after having been below it — a classic mean-reversion setup.

SELL Signal: Price touches or crosses above the upper Donchian band, then reverses and closes back below it. This captures reversals from overextended levels.

Best For: Range-bound or sideways markets where price oscillates between support and resistance. Works well on higher timeframes (H4, daily) where false breakouts are less frequent.

Strategy 2: Breakout at Channel Extremes

BUY Signal: Price closes above the upper Donchian band, indicating momentum to the upside. The EA enters long when the close exceeds the highest high of the lookback period.

SELL Signal: Price closes below the lower Donchian band, confirming bearish momentum. Entry occurs when the close drops under the lowest low of the lookback period.

Best For: Trending markets with strong directional moves. Avoid using this in choppy conditions — you'll get whipsawed. I prefer this on M15-M30 for breakout scalping on major pairs like EURUSD and GBPUSD.

Step-by-Step Workflow

Step 1: Attach to a single chart: Drag the EA onto any chart — it doesn't matter which pair, since the EA reads your symbol list from inputs. A 1H EURUSD chart is a common starting point.

Step 2: Configure your symbol list: In the SYMBOLS input, enter comma-separated pairs like EURUSD,GBPUSD,USDCHF,USDJPY . The EA will scan and trade all of them from this one chart.

Step 3: Set lot size and risk: Enter your base Lot Size (0.01 for micro, 0.10 for mini). Choose your SL/TP mode — most traders start with PIPS mode and set STOPLOSS to 30 and TAKEPROFIT to 60.

Step 4: Choose your entry strategy: Under Entry Strategy, select either reversal or breakout mode. If you're unsure, start with reversal (Strategy 1) — it's more forgiving for beginners.

Step 5: Enable or disable hidden SL/TP: Leave HIDDEN_SL_TP set to true to avoid giving away your levels to brokers. The virtual SL/TP lines won't show during optimization anyway.

Step 6: Run a backtest first: Before going live, test on at least 6 months of data across multiple pairs. Watch for drawdown spikes — if you see them, reduce lot size or widen your stop.

Step 7: Monitor and adjust: Once live, check the EA's journal tab daily for trade logs. Adjust period and margins based on which pairs are performing best.


4. RISK MANAGEMENT FEATURES

The EA includes several built-in risk controls that let you tailor exposure per trade, per pair, and across your entire portfolio.

Feature Description
Multiple SL/TP Modes Choose from Pips, Amount, Percent, Group Amount, Group Percent, or No SL/TP. This flexibility lets you match your risk style — fixed pips for scalping, account percentage for long-term trading.
Hidden Stop-Loss & Take-Profit When enabled, SL/TP levels are managed internally without sending them to the broker. This prevents stop-hunting and keeps your strategy private. Virtual lines can be shown on the chart for visual reference.
Group-Level Risk Controls Set a combined stop-loss or take-profit across all open positions using Group Amount or Group Percent modes. Useful for capping total portfolio drawdown — if your 5 pairs lose $200 combined, the EA closes everything.
Customizable Lot Sizing Fixed lot size per trade, adjustable from 0.01 to any value. No martingale or compounding built in — keeps risk predictable. Pair this with Percent-based SL for consistent risk per trade regardless of pair volatility.
Multi-Symbol Trade Management The EA tracks positions per symbol independently, so a stop-loss on EURUSD won't affect a running GBPUSD trade. Group controls are the only cross-symbol feature — everything else is isolated per pair.

5. IMPORTANT NOTES & WARNINGS

Known Limitations

Issue Explanation
No Trade Filtering by Time The EA doesn't include a session filter or news filter. It will trade during low-liquidity periods (Asian session, Friday afternoons) where Donchian breakouts are less reliable. Consider adding manual time restrictions or disabling the EA during major news.
Single Chart Dependency All trading logic runs from one chart. If that chart loses connection or the terminal restarts, all pairs stop trading. There's no fallback or redundant instance — keep your VPS stable and test reconnection behavior.
No Partial Close or Trailing Stop The EA uses fixed SL/TP only. There's no trailing stop, break-even management, or partial profit-taking built in. If you want those features, you'll need to combine this EA with a separate trade management tool.
Optimization Blindness During Strategy Tester optimization, the hidden SL/TP lines are never drawn, and the EA may behave differently than on live charts. Always validate optimized parameters with a visual forward test before going live.

Settings Beginners Should NOT Change

Setting Why to Leave Default
HIDDEN_SL_TP Setting this to false exposes your stop and target levels to the broker, increasing the risk of stop-hunting. The default true keeps your strategy private and is standard practice among experienced traders.
SLTP_MODE The default Amount mode is the most intuitive — you set exact dollar values for SL and TP. Switching to Percent or Group modes without understanding the math can lead to unexpected position sizing or premature exits.
Margins The default -2 creates a small buffer inside the channel bands, reducing noise entries. Changing this to a positive value or zero can cause excessive whipsaw trades, especially on lower timeframes.
Period of averaging The default 20 is a widely tested value that balances responsiveness with reliability. Dropping below 10 increases false signals; going above 50 makes the channel too slow for most intraday strategies.

Dashboard Usage Tips

  1. Start with 3-4 pairs max: Don't overload the EA with 10+ pairs right away. Begin with EURUSD, GBPUSD, and USDJPY — they have the tightest spreads and most reliable Donchian behavior. Add pairs slowly as you gain confidence.
  2. Match timeframe to strategy: Reversal strategies work best on H1-H4 where mean reversion has room to play out. Breakout strategies can work on M15-M30 but expect more false signals — widen your margins to compensate.
  3. Use the journal tab for debugging: The EA logs every trade decision to the Experts tab. If you see unexpected entries, check the journal for the exact price and band values at decision time. This is your best diagnostic tool.
  4. Backtest with 'Every Tick' mode: Don't rely on 'Open prices only' for Donchian strategies — the channel depends on high/low values that can be missed with lower-quality modeling. Every Tick mode gives you realistic entry and exit prices.
  5. Monitor correlation between pairs: If you're trading EURUSD and GBPUSD simultaneously, they're highly correlated. A single market move can trigger both, doubling your exposure. Consider reducing lot size for correlated pairs or using Group SL to cap total risk.
  6. Set alerts for drawdown thresholds: The EA doesn't have built-in drawdown alerts. Use your broker's or platform's account monitoring tools to notify you if equity drops below a certain level — say 20% — so you can intervene manually if needed.

Quick Start Guide

Follow these steps to get started in under 5 minutes:

  1. Download and install: Purchase the EA from the MQL5 Market, then download and install it to your MT4 or MT5 terminal. Restart the platform if prompted.
  2. Attach to a chart: Open any chart (EURUSD H1 is fine), drag the EA from the Navigator panel onto the chart. Accept the confirmation dialog.
  3. Enter your symbol list: In the EA's input dialog, find the SYMBOLS field. Replace the default with your desired pairs: EURUSD,GBPUSD,USDJPY . Keep it to 3-5 pairs for your first run.
  4. Set your lot size: Change LOTS to 0.01 for a micro account or 0.10 for a mini account. Never exceed 0.10 on your first test — you're here to learn, not to gamble.
  5. Configure SL/TP: Leave SLTP_MODE as Amount. Set STOPLOSS_AMOUNT to 10 (dollars) and TAKEPROFIT_AMOUNT to 20. This gives you a 1:2 risk-reward ratio.
  6. Choose your entry strategy: Under Entry Strategy, select ENTRY_STRATEGY1 (reversal at bands). This is the safer option for beginners — it catches reversals rather than chasing breakouts.
  7. Run a backtest: Open the Strategy Tester (Ctrl+R), select the EA, set date range to the last 6 months, and use 'Every Tick' mode. Run the test and check the results — look for a profit factor above 1.5 and max drawdown under 15%.
  8. Go live on demo: Once you're happy with backtest results, attach the EA to a demo account with the same settings. Let it run for at least 2 weeks before considering a live account. Monitor the journal daily for any errors or unexpected behavior.


Installation Guide for MQL Products | Updating Purchased MQL Products on MT4/MT5 | General Troubleshooting Guide | Backtest and Set Files

Check all my products: https://www.mql5.com/en/users/biswait50/seller

Contact me for support: https://www.mql5.com/en/users/biswait50