On this page
Back to tutorials

Donchian Breakout EA MT5 — No Code

Channel breakout EA: Length 20, Breakout Up/Down, Price Cross alternative, export MQL5, H1 Every tick Strategy Tester workflow.

📖 16 min read

📝 3,200 words

🏷️ MQL5 & Expert Advisors

Share this article:

Try the workflow from this guide

Open the live demo first — no signup. Sign up later to save your strategy and export from Code Generator.


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 BreakoutDirection Up, Threshold 0, Period 5, Confirmation 1. On Sell, BreakoutDirection 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 CrossUpper 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:

SignalRule
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

SettingStarter valueNotes
Length20Default in builder (1–100); classic “20-day” idea
Breakout Period5Bars price must have been inside channel
Breakout Threshold0Band edge only
Confirmation12 bars reduces false breaks
TimeframeH1 or D1H1 more signals; D1 cleaner trends
SymbolEURUSD, indices, commoditiesGold: 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):

ParameterTypeRangeDefaultWhat it does
LengthNumber1 – 10020Lookback 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:

FieldRange / optionsDefault
DirectionUp · Downup
ThresholdNumber (step 0.01)0
Period1 – 505
Confirmation1 – 101

Classic recipe:

TabDirectionThresholdPeriodConfirmation
BuyUp051
SellDown051

Meaning: Enter when price breaks above the upper channel after being inside Period bars · sell on lower break.


2. Price Cross

FieldOptionsDefault
BandUpper Band · Lower Band · Middle Bandupper
SmoothingNone, SMA, EMA, WMAnone
SourceClose, Open, High, Lowclose

Use case:

TabBandSource
BuyUpper BandClose
SellLower BandClose

Simpler than Breakout when you do not need “was inside channel N bars ago.”


3. Pullback

FieldRangeDefault
DirectionUp · Downup
Thresholdstep 0.010
Confirmation1 – 101

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)

  1. Add Donchian ChannelLength 20.
  2. Condition BreakoutDirection Up, Threshold 0, Period 5, Confirmation 1.

Step 3 — Sell

  1. Same Length 20.
  2. BreakoutDirection 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 F7Strategy TesterEvery tickDemo before live.

Advanced MTF & Filters if you add H4 trend bias on Step 2.


Improvements: Filters and Risk

IssueFix
Too many false breaksRaise Confirmation to 2 or Period to 10
Late entriesShorter Length (14) — more responsive, more noise
Range lossesSession filter · ADX > 25 AND breakout (see ADX guide)

Next Steps

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.

Build this EA in Strategy Builder

Start in the live demo — no signup required. Walk through signals, filters, and risk. Create a free account only when you want to save and export MQL5.

Frequently Asked Questions

Yes. Add Donchian Channel on Step 3 in Strategy Builder, use Breakout Direction Up for Buy and Down for Sell (Length 20, Threshold 0, Period 5, Confirmation 1), set risk on Step 5, save, export MQL5 from Code Generator, compile once, and backtest with Every tick.

Length 20 is the builder default and matches the classic 20-day channel idea on daily charts. On H1, test 20–55 in Strategy Tester on your symbol before live.

Breakout requires price to have been inside the channel N bars ago then break the upper/lower band. Price Cross fires when Close crosses the upper or lower band directly — simpler, sometimes more signals.

This guide teaches one public Donchian breakout template in Strategy Builder — not a full Turtle portfolio ruleset. Educational only; backtest and Demo on your broker.

No. Breakouts fail in choppy markets. This guide is educational: backtest, then Demo, then live with controlled risk.

Try Strategy Builder — no signup

Try Strategy Builder — No Signup