Join today
Strategies / Breakout / Donchian Channel Breakout

Donchian Channel Breakout (20/10)

A close above the 20-bar high opens a long, and a close below the 20-bar low opens a short. Positions close when price crosses the opposite 10-bar channel or hits a 1% stop. It was tested on index and Gold charts from 5 minutes to 1 hour.

BreakoutLong & shortSwingDAX 401 hour
1.04Profit factor
5,872Net profit EUR
35.51%Win rate
3,444Trades
-4,299Max drawdown
1.70Avg trade

Best run of 16. DAX 40, 1 hour, spread 3, from run pf:2026-09-15-DAX40-1h.tsv:1.

Entry rules, long

  1. Members only
  2. No position is open

Entry rules, short

  1. Members only
  2. No position is open

Exit rules

  1. Stop loss at 1% from entry
  2. Members only
  3. Close a short when price closes above the highest high of the previous 10 bars

Test conditions

PeriodUp to 2026-09-15
InstrumentDAX 40, 1 hour
Spread3 points
Contracts1
Starting capital1,000,000
CostsSpread only. Commissions and overnight financing are not included.
BarsUp to 200,000 bars, fewer where the instrument has less history
Last tested2026-09-15

Parameters

positionSize
Contracts per trade
1
channelPeriod
Entry channel length
20
exitPeriod
Exit channel length
10
stopLossPct
Protective stop, percent of entry price
1

Every run

Markets and timeframes tested

MarketTimeframePFTradesWin %NetMax DD
DAX 40Best run1 hour1.04 3,44435.515,872 EUR-4,299
Gold1 hourn/a 3,40135.67240 EUR-816
Gold30 minn/a 5,56634.44-211 EUR-3,134
Gold15 minn/a 5,44731.28-1,708 EUR-3,514
Gold5 minn/a 5,49031.86-3,707 EUR-3,867
S&P 5005 minn/a 5,59631.61-4,442 EUR-4,496
DAX 4030 minn/a 5,85034.92-5,311 EUR-9,461
S&P 50030 minn/a 5,93933.68-5,417 EUR-6,873
S&P 5001 hourn/a 3,92333.98-5,799 EUR-6,267
S&P 50015 minn/a 5,84132.12-7,472 EUR-7,561
Nasdaq 1005 minn/a 5,68033.87-8,625 EUR-8,712
Nasdaq 10030 minn/a 6,10534.22-9,101 EUR-14,235
Nasdaq 1001 hourn/a 4,01233.57-10,985 EUR-13,661
Nasdaq 10015 minn/a 5,81733.02-12,669 EUR-16,373
DAX 4015 minn/a 5,72433.61-18,816 EUR-18,832
DAX 405 minn/a 5,75931.62-20,430 EUR-20,671

Charts

Results by run

Net profit against max drawdown

Net profitMax drawdown
0-25K-13K5K10KDAX 40 · 1 hourGold · 1 hourGold · 30 minGold · 15 minGold · 5 minS&P 500 · 5 minDAX 40 · 30 minS&P 500 · 30 minS&P 500 · 1 hourS&P 500 · 15 minNasdaq 100 · 5 minNasdaq 100 · 30 minNasdaq 100 · 1 hourNasdaq 100 · 15 minDAX 40 · 15 minDAX 40 · 5 min

The code

ProBuilder, rewritten to house standard

Every file in the library uses the same header, the same section order and the same variable names. The numbers above were produced by the original version before the rewrite, and the rewrite has not yet been compiled in ProRealTime.

// ============================================================
// Donchian Channel Breakout
// ProRealAlgos Strategy Library  |  prorealalgos.com
// Type: Breakout
// Direction: Long & short
// Timeframe tested: 1 hour
// ============================================================

// --- Settings ---
DEFPARAM CumulateOrders = false

// --- Parameters ---
positionSize = 1          // contracts per trade
channelPeriod = 20        // entry channel length
exitPeriod = 10           // exit channel length
stopLossPct = 1           // protective stop, percent of entry price

// --- Indicators ---
// Channels end on the previous bar, so the breakout bar cannot set its own level.
channelHigh = Highest[channelPeriod](high)[1]
channelLow = Lowest[channelPeriod](low)[1]
exitHigh = Highest[exitPeriod](high)[1]
exitLow = Lowest[exitPeriod](low)[1]

26 more lines: the entry and exit rules.

Read this first

Known weaknesses

  • Only one of the market runs in the table was profitable (Gold 1 hour, EUR 240.2). Nasdaq 100 15 minutes ended at EUR -12,668.6 and DAX 40 5 minutes at EUR -20,430.3.
  • The best run on DAX 40 1 hour had a profit factor of 1.04 and made EUR 1.7 per trade over 3,444 trades, a margin that commissions could wipe out.
  • The win rate in the best run is 35.51%, so the system relies on a few large trends to pay for many small losses.

Indicators used

Donchian Channel

How to load it

  1. Copy the code with the copy button above the code block.
  2. In ProRealTime, open a chart of the instrument and timeframe you want to test, then open ProOrder > New trading system and choose "Create with programming".
  3. Paste the code, give the system a name and save it.
  4. Click "Backtest", set your own spread and position size, and run it before you consider trading it live.

Questions

About this strategy

Can I run the Donchian breakout in ProOrder?

Yes, all rules are automatable. The code was rewritten after testing and is not compile-checked, and the test results are weak, so treat live use with caution.

Which markets and timeframes were tested?

DAX 40, Nasdaq 100, S&P 500 and Gold on 5, 15, 30 minute and 1 hour charts. Apart from the DAX 40 1 hour best run and Gold 1 hour, every sweep lost money.

How much drawdown at 1 contract?

The DAX 40 1 hour run saw a max drawdown of EUR 4,298.5 against EUR 5,871.8 net profit. The worst sweep drew down EUR 20,670.9.

Why do shorter timeframes do worse?

The 3 point spread is a bigger share of each trade on 5 and 15 minute bars, and the channel breaks more often, so losses stack up.

Related

Strategies like this one

Turtle Trade

Uses the same indicator.

2.42 PF · 6,324 trades

Buy After Price Fall

Best run on the same market, DAX 40.

1.88 PF · 312 trades

Trend Surfer

A similar profit factor.

1.04 PF · 10,813 trades

Want to see which breakout systems made the cut for live trading? Join the ProRealAlgos waitlist.

The ProRealAlgos community gets the full rules, the complete code and the automated portfolio.

Past backtest results do not guarantee future results. This is not financial advice. Curated and maintained by ProRealAlgos. ProRealTime™ is a trademark of ProRealTime SAS. prorealalgos.comStatsDocs