VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Indicators and signals

Donchian channel breakout: rules, settings and how to test them

A Donchian channel marks the highest high and lowest low of the last N bars. A breakout strategy trades moves beyond those lines. Test it with costs and next-bar fills, judge it by a wide area of good lengths rather than one best setting, and expect many small losses between trends.

By · Published · updated · Editorial policy

Contents
  1. How does the Donchian channel work?
  2. Which exact rules does a Donchian breakout strategy need?
  3. Which entry and exit variants should you test?
  4. What were the turtle trading Donchian rules?
  5. What are good Donchian channel settings?
  6. Why does a Donchian breakout lose more trades than it wins?
  7. How much do costs and whipsaws take from a Donchian system?
  8. When do trend breakouts stop working?
  9. Frequently asked questions
  10. References

How does the Donchian channel work?

A Donchian channel draws the highest high and the lowest low of the last N bars. A breakout strategy buys when price moves above the upper line and sells short below the lower line. It then exits on a shorter opposite channel or a stop. Test it with costs, next-bar fills and a range of lengths, not one.

A Donchian channel is a price band whose upper line is the highest high and whose lower line is the lowest low of the last N bars. It is named after Richard Donchian, an early trend follower. The middle line sits halfway between the two. Nothing is averaged or smoothed. A line moves only when a new extreme enters the window or an old extreme drops out of it. The Donchian channel indicator page shows the lines on a chart. This article is about turning them into rules and testing those rules.

A breakout is a move of price beyond the highest high or lowest low of a chosen look-back period. When price trades above the upper line, the market is at its highest level in N bars. The trend-following idea is simple. Such moves must continue often enough, and far enough, to pay for the many times they do not.

A Donchian breakout trade: price moves sideways inside a 20-bar channel, a long entry is marked where price breaks above the 20-bar high, and the exit is marked where price later falls below a shorter 10-bar low Enter on the 20-bar high Exit on a shorter 10-bar low 20-bar channel Entry 10-bar low Exit Middle The exit is shorter than the entry. So: test the exit as its own rule.
A Donchian breakout trade: enter when price breaks the 20-bar high, exit when it breaks a shorter 10-bar low.

Which exact rules does a Donchian breakout strategy need?

A testable Donchian strategy needs seven decisions written down before the first run, because each one changes the result.

  1. Bars and session. Choose the bar size and whether night-session bars are included. Highs and lows differ between day-only and full-session data. Also, 20 bars on 60-minute bars cover a few days, not 20 days.
  2. Entry length N. This is the number of bars that sets the breakout level.
  3. Channel reference. Build the channel from the previous N bars, without the current bar.
  4. Entry trigger. One option is a stop order at the line during the next bar. The other is to wait for a close beyond the line and enter at the next bar's open.
  5. Exit. Options include an opposite breakout of a shorter length M, a cross of the middle line, a stop, or a time limit.
  6. Initial stop. This is the loss level for a breakout that fails at once.
  7. Direction and size. Choose long only, short only or both. Choose a fixed number of contracts or a size based on volatility.

A stop order at the channel line is fair to simulate. The level is known before the next bar opens. If that bar opens beyond the level, a realistic test fills at the open, not at the line. A close-confirmation entry decides at the bar close and fills on the next bar. This is next-bar execution, and it avoids trading at a price you could not have reached.

Which entry and exit variants should you test?

Test a small set of clearly different variants. In breakout systems, the exit decides how much of a trend you keep, and that often matters as much as the entry length.

VariantEntryExitWhat it tests
Stop and reverseBuy above the N-bar high, sell short below the N-bar lowThe opposite signal reverses the positionAlways in the market. The simplest version, with the most whipsaws in ranges.
Asymmetric channelN-bar breakoutOpposite M-bar breakout, with M shorter than NGives back less of a trend. Flat between trades.
Close confirmationClose beyond the line, enter at the next bar's openAny of the exits aboveFewer false breaks inside a bar, but a later entry price.
Middle-line exitN-bar breakoutClose crosses the middle lineA tighter exit from the same channel.
Volatility stopN-bar breakoutA stop at a multiple of ATR (average true range) from entry, plus a channel exitLimits the loss of failed breakouts.
Trend filterBreakout only in the direction of a longer channel or a moving averageAny of the exits aboveFewer trades against the larger trend.

What were the turtle trading Donchian rules?

The Turtle traders used two Donchian systems on daily bars. This was a group of trainees taught by Richard Dennis and William Eckhardt.

  • System 1 entered on a 20-day breakout and exited on a 10-day breakout in the other direction. It skipped a 20-day signal if the previous 20-day breakout would have been a winning trade.
  • System 2 entered on a 55-day breakout and exited on a 20-day breakout.
  • Stops and size. Both systems used an initial stop of 2N. N was a 20-day average of the true range, similar to ATR. Position size was set so that a move of one N changed the account by about 1%.

To test turtle-style rules, copy the structure, not the numbers. Days on daily bars are a different thing from bars on your timeframe, so 20/10 on 15-minute bars is a different system. The skip-after-winner filter also needs care. It depends on the outcome of the previous signal even when that trade was not taken. Keep tracking each skipped signal as a simulated trade; otherwise the filter will not work as designed.

What are good Donchian channel settings?

Good Donchian channel settings lie inside a wide area of similar results. The single best length in the test is not the goal. Think of choosing a campsite. A flat field is safer than the top of a narrow peak, even if the peak is a little higher.

Hypothetical example

A trader tests entry lengths from 20 to 70 bars, each with an exit at half the entry length, on one futures contract with costs included. The profit factor is gross profit divided by gross loss. In the results below, lengths 30 to 60 form a plateau. A second test shows a spike: length 37 reaches 1.45, but lengths 35 and 40 are near 1.00. The plateau is the better candidate, even though its best value is lower.

Entry length203040506070
Profit factor1.051.251.301.281.221.10
Hypothetical profit factor by entry length: a plateau line at 1.05, 1.25, 1.30, 1.28, 1.22 and 1.10 for lengths 20 to 70, and a spike line near 1.00 everywhere except 1.45 at length 37 A plateau beats a spike Profit factor by length, hypothetical 1.0 1.4 20 30 40 50 60 70 Spike Plateau Neighbours agree on the plateau. So: pick a length from its middle.
Hypothetical example: a plateau of similar results across lengths is more trustworthy than one sharp peak.

Use these steps to find and check the plateau:

  1. Start with coarse steps such as 10, 20, 30 and so on. Fine steps like 37 versus 38 give false precision.
  2. Vary the entry and the exit separately. The Turtle rules used exits between about a third and a half of the entry length, which is a reasonable starting range.
  3. Repeat the same grid on other markets and timeframes. A breakout idea that only works on one contract at one length is weak evidence.
  4. Run walk-forward analysis. Walk-forward analysis is a test that chooses parameters on one period and then trades them unchanged on the next period. See walk-forward analysis: why one backtest is not enough.

In AlphaPrime (Valynox), strategy generation takes parameter ranges, entry and exit conditions and search constraints as inputs. A grid of lengths and several exit variants can therefore be evaluated with the same settings, not one backtest at a time.

Why does a Donchian breakout lose more trades than it wins?

Trend breakout systems often win fewer than half their trades, because many breakouts reverse. They can still have a positive expectancy if the winners are several times larger than the losers. A whipsaw is a breakout that reverses soon after entry, so the trade is stopped out or reversed at a loss. In a sideways market, whipsaws come one after another.

Expectancy is the average result you can expect per trade over many trades. It is the one number that combines win rate and trade size:

Expectancy = (win rate × average win) − (loss rate × average loss)

Win rate is the share of winning trades. Loss rate is the share of losing trades. Average win and average loss are the sizes of a typical winner and a typical loser. The win rate and expectancy calculator does this from your own backtest figures.

Hypothetical example

A breakout system wins 35% of its trades. The average win is 3.0R and the average loss is 1.0R, where R is the initial risk of one trade. The expectancy is 0.35 × 3.0 − 0.65 × 1.0 = 1.05 − 0.65 = 0.40R per trade. The chance of eight losses in a row is 0.65 to the power of 8, which is about 0.03. Over a few hundred trades, a run of eight losses is therefore likely to appear at least once.

Hypothetical breakout trades: in a sideways range three breakouts of the channel high reverse for losses of 1R each, then in a trend one breakout gains 5R Three losses, one big win Hypothetical breakout trades, in R −1R −1R −1R +5R Range Trend Small losses come in a row. So: size to survive the streaks.
Whipsaws in a range produce a series of small losses; one trend breakout has to pay for them.

From your own results, read three numbers: the ratio of average win to average loss, the longest losing streak, and the longest time from an equity high to a new high. Then decide whether you could follow the rules through those periods.

How much do costs and whipsaws take from a Donchian system?

Costs take a much larger share from short channel lengths, because they trade more often and capture smaller moves per trade. Slippage is the difference between the price the backtest assumes and the price you would actually get. Breakout stop orders sit where many other traders also have orders, so fills at the channel line are often worse than the line itself.

Hypothetical example

Two versions run on the same contract over the same years. Version A uses a 10-bar entry and a 5-bar exit. It makes 400 trades with an average gross trade of 3 ticks, so 1,200 ticks gross. Version B uses a 50-bar entry and a 25-bar exit. It makes 80 trades with an average gross trade of 14 ticks, so 1,120 ticks gross. The round-trip cost is 2 ticks. After costs, A keeps 1 tick per trade, or 400 ticks. B keeps 12 ticks per trade, or 960 ticks. A looked better before costs and is clearly worse after them.

  • Double the slippage and run the test again. A system that fails this test depends on cheap fills.
  • Fill gaps at the open. When a session opens beyond the channel or beyond a stop, the fill is the open price, not the line.
  • Include costs during the search. Ranking lengths without costs favours the short, busy versions that costs remove later. See trading costs in backtests for how to set commission and slippage.

When do trend breakouts stop working?

Trend breakouts stop paying in long sideways markets. A backtest can hide this when a few large trends carry the whole result. Four checks make this visible:

  1. Results by year. A breakout system can lose for many months in a row. Yearly or quarterly results show how long those stretches lasted in your test.
  2. Concentration. Remove the best three or five trades and look at the result again. If it turns negative, the system depends on rare events. Judge whether your test period has enough of them.
  3. Selection. Testing many lengths, exits and markets, and then keeping the best one, inflates that best result. Sullivan, Timmermann and White tested a large set of technical rules, channel breakouts among them. They showed that the best rule from a search must be judged against how many rules were tried. White's reality check is a formal method for this.
  4. Changing volatility. A fixed N-bar channel is narrow in quiet markets and wide in volatile ones. That changes both the number of trades and the size of each loss. Volatility-based sizing, as in the Turtle rules, keeps the risk per trade steadier. It does not change the signal.

None of these checks removes the losing periods. They show you how large and how long those periods were in the past, which is what you need to know before trading the rules.

What this means if you use AlphaPrime: write the Donchian idea as entry and exit conditions with parameter ranges, and keep fees, slippage and next-bar execution in every evaluation. Then judge the result by the plateau and by the walk-forward periods, not by the single best run.

Frequently asked questions

What is the best Donchian channel setting?

No single setting is best for every market and timeframe. The Turtle rules used 20-day entry with 10-day exit, and 55-day entry with 20-day exit, on daily bars. These are reasonable starting points. On your own data, test a range of lengths and choose one from the middle of an area where neighbouring lengths give similar results.

What is the difference between Donchian channels and Bollinger Bands?

A Donchian channel uses only the highest high and the lowest low of the last N bars. Bollinger Bands are drawn a number of standard deviations above and below a moving average. Donchian lines stay flat until a new extreme enters the window or an old one drops out of it. Bollinger Bands move with every bar.

Should a Donchian breakout enter on a stop order or on the close?

Both are valid, and they are different systems. A stop order at the line enters earlier but is triggered by more short-lived breaks. A close-confirmation entry waits for the bar to close beyond the line and fills on the next bar, which gives fewer false signals and a worse entry price. Test both with the same costs and compare them.

Does turtle trading with Donchian channels still work?

A past result cannot answer that for the future. What you can do is test the turtle-style structure on your own markets and timeframes, with costs and next-bar fills. Look at results across many lengths and markets, the longest losing stretch, and the walk-forward periods.

Can a Donchian channel be used on intraday bars?

Yes. N then counts bars, not days, so a 20-bar channel on 15-minute bars covers about five hours of trading. Intraday versions trade more often, so costs and slippage take a larger share of each trade. The session setting also matters, because day-only and full-session bars give different highs and lows.

References

  • Sullivan, R., Timmermann, A., & White, H. (1999). Data-Snooping, Technical Trading Rule Performance, and the Bootstrap. The Journal of Finance, 54(5), 1647–1691.
  • White, H. (2000). A Reality Check for Data Snooping. Econometrica, 68(5), 1097–1126.

What AlphaPrime does here

AlphaPrime's strategy generation turns a breakout idea into testable rules with parameter ranges and entry and exit conditions. AlphaPrime's backtesting evaluates each candidate with fees, slippage, next-bar execution and your trading sessions.

See plans and pricing