Donchian Channels Explained: Lookback Periods, Breakouts and Trading Rules
Donchian Channels plot the highest high and lowest low over a chosen number of bars, with an optional midpoint halfway between them. They show the recent trading range and are often used to define objective breakout rules. The key implementation question is whether the channel includes the current candle. A breakout against the previous N completed bars must exclude the current bar from its reference level.
Formula and lookback convention
For a decision at bar t, define U as the maximum of highs from t−N through t−1 and L as the minimum of lows over that same window. The midpoint is (U+L)/2. A conventional setting is 20 bars, which means 20 trading observations rather than necessarily 20 calendar days. Some chart packages instead display the extrema including the current bar; a trading rule can reference the previous plotted value in that case. Both conventions can be legitimate, but they cannot be interchanged silently.
| Completed bar | High | Low |
|---|---|---|
| 1 | 105 | 98 |
| 2 | 108 | 100 |
| 3 | 110 | 102 |
| 4 | 109 | 101 |
| 5 | 112 | 104 |
For a five-bar window preceding bar six, U=112, L=98 and midpoint=105. Width is 14 price units. The levels are known before bar six starts, provided the five input bars are final.
Why the current-bar convention matters
Suppose bar six has high 114, low 106 and close 113. The close is above the previous upper boundary of 112. If the five-bar window includes bar six, its upper boundary becomes 114 and the lowest low becomes 100 because bar one leaves the window. Since a valid close cannot exceed its own high, a strict close-above-current-maximum test cannot trigger. The display may show a useful channel but the strategy needs a correctly lagged reference.
Channel expansion and contraction
A new extreme can widen the channel; an old extreme leaving the rolling window can narrow it even with little new price movement. A shorter lookback generally produces more frequent changes. A longer one may react more slowly and produce wider risk distances. Channel width is a range of observed prices, not an estimate of standard deviation or a confidence interval.
| Tool | Boundary calculation | Key distinction |
|---|---|---|
| Donchian | Rolling high and low | Depends on extreme observations |
| Keltner | Moving average ± ATR multiple | Depends on smoothed range |
| Bollinger | Moving average ± standard deviation multiple | Depends on dispersion |
| Manual channel | Parallel pivot-based lines | Depends on selected anchors |
Worked breakout research example
A simulated fill at 114 after a close above 112, with an illustrative exit level of 105, produces 9 units of planned risk. An exit at 101 after a gap would lose 13 units before fees, not nine. A separate shorter exit channel is another research option: for example, a 20-bar entry window with a 10-bar opposite exit window. It must use its own correctly lagged extrema and does not imply any particular success rate.
How to validate a rule
Specify the entry and exit lookbacks, strict or inclusive crossing, session, bar completion time, fill convention and position sizing before collecting results. Check whether signals can be executed at the displayed price, especially after overnight gaps or during thin liquidity. Include all range breakouts, including whipsaws. Compare with a simple trend benchmark after costs and test on later data, not just the period used to choose N.
Reproduce the breakout in a spreadsheet
Put the high, low and close of each completed bar in columns B, C and D. If bars one to five occupy rows 2–6, the reference for bar six (row 7) is MAX(B2:B6) for the upper band and MIN(C2:C6) for the lower band. Compare D7 with those two results, not MAX(B3:B7). Move the formulas down one row at a time. Keep separate columns for the signal timestamp, the first eligible execution and the exit timestamp. This also makes it possible to spot a common off-by-one error by checking the first bar that has enough prior observations.
Compare two research designs on the same data
Design A buys in a simulator only after a completed close above the prior 20-bar high and exits on a close below the prior 10-bar low. Design B uses the same entry and a time-based exit after ten bars. Both should use the same fill convention and not assume a price available before the signal. If the reference high is 112 and the next opening price is 118, a simulated order triggered after the close cannot be credited with a fill at 112 without supporting execution evidence. Record gross and net profit, number of trades, exposure time and maximum drawdown for each design. A wider exit can improve some individual outcomes while exposing a position to more adverse movement. The comparison therefore needs both return and risk metrics, not just a count of winning trades.
For further practice compare the Donchian midpoint with the centre of Keltner Channels on the same completed price series. They can differ substantially after a single extreme expires.
FAQs
Is a touch of the upper line a breakout?
Only if the defined rule counts a touch; a strict close above the previous high is a different criterion.
What does the middle line represent?
The midpoint of the window’s extremes, not the average closing price.
Are 20 bars always best?
No. Lookback length depends on the research horizon and requires independent validation.
Continue with manual price channels, breakout and range trading and backtesting without hindsight.
Continue your learning with technical analysis foundations and learning pathways and Aroon.
Further reading
StockCharts ChartSchool: Price Channels documents the prior-period convention.
General educational information only, not personalised financial advice. Trading involves risk of loss.
Stay Ahead of the Markets
Get market analysis, financial news and practical trading insights delivered straight to your inbox.