Donchian Channel Breakout EA for MT5 — No Code
Can I build a Donchian breakout EA for MT5 without coding?
Yes. Add Donchian Channel on Step 3 — Signals in AlfaTactix Strategy Builder. On Buy, condition Breakout → Direction Up, Threshold 0, Period 5, Confirmation 1. On Sell, Breakout → Direction Down, same threshold/period/confirmation. Set Length 20 on the indicator. Add Stop Loss / lot size on Step 5, Save, export MQL5 from Code Generator, compile once in MetaEditor, backtest H1 EURUSD with Every tick in the Strategy Tester.
Alternative: Price Cross → Upper Band + Source Close for Buy · Lower Band for Sell.
Disclosure: This is an educational build guide, not financial advice. Backtest and Demo results do not guarantee live profits.
Related guides: Donchian Channel Indicator (academy) · Bollinger Breakout EA — No Code · Build EA Without Coding · Parabolic SAR EA — No Code · Backtest in Strategy Tester · EA Strategy Library
What Is a Donchian Breakout EA?
A Donchian Channel breakout Expert Advisor automates one of the oldest channel breakout systems in trading:
| Signal | Rule |
|---|---|
| Buy (long) | Price breaks above the upper band (highest high over N periods) |
| Sell (short) | Price breaks below the lower band (lowest low over N periods) |
Donchian Channel plots upper, middle, and lower lines from rolling highs and lows. Turtle-style trend followers popularized 20-day (or 55-day) breakouts. In MQL5, channels use rolling extremes; Strategy Builder exposes Length and Breakout logic without hand-coding loops.
Why traders search for this: Clear rules for trend continuation after range expansion. Tutorials often show MQL5 arrays or Pine scripts. This guide shows the same logic with every parameter and condition Donchian Channel exposes in AlfaTactix.
Classic Donchian Settings and When It Works
| Setting | Starter value | Notes |
|---|---|---|
| Length | 20 | Default in builder (1–100); classic “20-day” idea |
| Breakout Period | 5 | Bars price must have been inside channel |
| Breakout Threshold | 0 | Band edge only |
| Confirmation | 1 | 2 bars reduces false breaks |
| Timeframe | H1 or D1 | H1 more signals; D1 cleaner trends |
| Symbol | EURUSD, indices, commodities | Gold: see spread filters in Gold RSI EA |
Works best: Strong trends after consolidation — London / New York liquidity for forex.
Struggles in: Sideways chop — breakouts reverse quickly. Mitigate with Step 4 session/spread filters or combine Breakout Up AND a trend filter from ADX Trend EA — No Code.
For indicator background, see Donchian Channel Academy guide.
Donchian Channel Parameters in Strategy Builder
On Step 3 — Signals, add Donchian Channel (Trend group):
| Parameter | Type | Range | Default | What it does |
|---|---|---|---|---|
| Length | Number | 1 – 100 | 20 | Lookback for highest high / lowest low |
Tip: Match indicator calculation timeframe to Step 2 trading TF (e.g. both H1).
Donchian Channel Condition Types Explained
Open Donchian Channel on Step 3 → Add condition. The product exposes three condition types:
1. Breakout (recommended for this EA)
| Field | Range / options | Default |
|---|---|---|
| Direction | Up · Down | up |
| Threshold | Number (step 0.01) | 0 |
| Period | 1 – 50 | 5 |
| Confirmation | 1 – 10 | 1 |
Classic recipe:
| Tab | Direction | Threshold | Period | Confirmation |
|---|---|---|---|---|
| Buy | Up | 0 | 5 | 1 |
| Sell | Down | 0 | 5 | 1 |
Meaning: Enter when price breaks above the upper channel after being inside Period bars · sell on lower break.
2. Price Cross
| Field | Options | Default |
|---|---|---|
| Band | Upper Band · Lower Band · Middle Band | upper |
| Smoothing | None, SMA, EMA, WMA | none |
| Source | Close, Open, High, Low | close |
Use case:
| Tab | Band | Source |
|---|---|---|
| Buy | Upper Band | Close |
| Sell | Lower Band | Close |
Simpler than Breakout when you do not need “was inside channel N bars ago.”
3. Pullback
| Field | Range | Default |
|---|---|---|
| Direction | Up · Down | up |
| Threshold | step 0.01 | 0 |
| Confirmation | 1 – 10 | 1 |
Use case: Enter on pullback toward the channel midline in an established trend — advanced; backtest first.
Trader-Reported Themes (Forums)
In public threads on r/algotrading and r/Forex, traders often report these themes (not profit claims):
- Donchian 20/55 breakouts are discussed as classic trend entries — many note long flat periods between signals.
- False breakouts spike when volatility is low — some combine channel width or Bollinger Squeeze ideas.
- Gold and indices need realistic spread in tester — see Strategy Tester vs Live.
Build the Donchian Breakout EA Step by Step
Step 1 — Name
Donchian 20 Breakout H1
Step 2 — Timeframes
Enable H1.
Step 3 — Signals (Buy)
- Add Donchian Channel — Length 20.
- Condition Breakout → Direction Up, Threshold 0, Period 5, Confirmation 1.
Step 3 — Sell
- Same Length 20.
- Breakout → Direction Down, Threshold 0, Period 5, Confirmation 1.
Step 4 — Filters (optional)
Market Session London/NY · Liquidity → hasSpread · News filter for event days.
Step 5 — Risk
Stop Loss / Take Profit / trailing — EA Risk Management. Wider stops suit channel breakouts on volatile symbols.
Step 6 — Save
Save → export from Code Generator.
Export, Compile, and Backtest
Compile F7 → Strategy Tester → Every tick → Demo before live.
Advanced MTF & Filters if you add H4 trend bias on Step 2.
Improvements: Filters and Risk
| Issue | Fix |
|---|---|
| Too many false breaks | Raise Confirmation to 2 or Period to 10 |
| Late entries | Shorter Length (14) — more responsive, more noise |
| Range losses | Session filter · ADX > 25 AND breakout (see ADX guide) |
Next Steps
- London Session Breakout EA — No Code — same Donchian logic + London session filter
- Test 10 EA Variations in One Day — sweep Donchian Length in Strategy Builder
- Bollinger Band Breakout EA — No Code — volatility-band breakout
- Parabolic SAR EA — No Code — trailing stop-and-reverse trend
- Build EA Without Coding
Before export: In the live demo, set Donchian Length 20 and trigger one Breakout Up on the chart you actually trade — if the entry bar matches what you would have drawn by hand, continue to Step 5 and risk. If not, fix Step 3 first; exporting won't fix wrong logic.
References: Donchian Channel (academy) · Strategy Tester.