A Donchian channel measures the highest high and lowest low over a rolling number of bars. It is a simple way to visualize price expansion, but a surprisingly common implementation mistake makes a close-based breakout impossible: comparing the signal candle's close with a channel that already includes that candle. Understanding the difference between a plotted channel and an actionable threshold is essential for reliable chart interpretation and backtesting.
1. What does a Donchian channel measure?
For an N-bar lookback, the conventional upper band is the maximum high and the lower band is the minimum low over the selected window; the middle band is their arithmetic midpoint. A plotted channel can legitimately include the latest candle. For a breakout decision on bar t, however, freeze the reference window at the previous completed bar.
Upper reference U(t) = max(H(t−1), …, H(t−N))
Lower reference L(t) = min(Low(t−1), …, Low(t−N))
Midpoint M(t) = (U(t) + L(t)) / 2
A close-based bullish breakout requires Close(t) > U(t); a bearish breakout requires Close(t) < L(t). Strict inequalities deliberately exclude exact touches. The chosen lookback counts bars, not elapsed calendar days, and should use consistent session and data definitions. The midpoint describes the reference range; it does not predict fair value.
2. Why including the current bar suppresses the signal
If the rolling upper band includes High(t), the maximum is at least High(t). Since a valid OHLC candle has Close(t) ≤ High(t), Close(t) cannot be strictly greater than that upper band. The same reasoning applies to a lower-band close breakout. Using greater-than-or-equal instead does not fix the problem: it changes the event into a condition that can include a close at a new or equal rolling extreme.

3. Worked example: a five-bar reference range
All prices below are hypothetical and are not historical market observations. A five-bar lookback is used to make the arithmetic transparent.
| Bar | Open | High | Low | Close |
|---|---|---|---|---|
| 1 | 101 | 105 | 99 | 103 |
| 2 | 103 | 108 | 101 | 106 |
| 3 | 106 | 107 | 102 | 104 |
| 4 | 104 | 109 | 103 | 107 |
| 5 | 106 | 106 | 100 | 105 |
| 6 | 105 | 112 | 105 | 111 |
| 7 | 111 | 113 | 108 | 109 |
| 8 | 109 | 110 | 104 | 105 |
Before bar 6 closes, the five reference highs are 105, 108, 107, 109 and 106. Their maximum is 109; the lowest low is 99, so the midpoint is 104 and the channel width is 10. Bar 6 closes at 111, two price units above 109, or about 1.83% above the reference high. If bar 6 is included instead, the five-bar high is 112 and the condition 111 > 112 is false. This is not a disagreement between two markets; it is a difference in window indexing.
Bar 7 has a high of 113 but closes at 109. Its own preceding five-bar upper threshold is 112, so it does not produce a new close-based breakout. Bar 8 closes at 105, below the original 109 breakout boundary. The breakout on bar 6 was correctly detected even though follow-through failed. Detection and profitability are different questions.
4. Separate confirmation, execution and invalidation
A trader can define a close above the prior channel as a candidate signal, optionally requiring a minimum penetration such as one tick or a preselected fraction of prior volatility. An intrabar stop-entry model is different: the threshold is known beforehand, but fills depend on the order type, gap, bid/ask spread and available liquidity. Do not assume a close-confirmed signal can be filled at that same close after observing it; a next-bar execution model or a separately justified close-order model is needed.
For illustration, suppose a long entry is actually filled at 111 on the next bar, with a protective stop at 105 and a hypothetical objective at 123. The planned price risk is 6 units, reward is 12, and reward-to-risk is 2:1 before costs. A close back below 109 could instead serve as a separate early-exit rule. Bar 8 reaches 104, so a stop at 105 could be triggered; actual fill may differ. With a $1-per-unit multiplier and a $120 planned risk budget, the theoretical maximum is 20 units before commissions and slippage; actual position size should account for costs, contract increments and gap risk. A stop is not a guarantee of maximum loss.
5. Common implementation and research mistakes
- Shifting only the upper band but not the lower band, or using a different lookback for long and short without an explicit rationale.
- Mixing an intrabar high crossing with a completed-bar close rule; log which event is being tested.
- Redrawing the threshold after entry and treating the new rolling band as the original breakout level.
- Ignoring warm-up: a prior-N-bar threshold is unavailable until N completed reference bars exist.
- Choosing N solely from the highest historical return. Test neighboring values, different volatility regimes, chronological out-of-sample periods, realistic costs and order-fill assumptions.
6. A practical validation checklist
Record signal timestamp, reference-window start and end, upper/lower threshold, actual close, order timestamp and actual fill. Test equal-high cases, gaps, insufficient history and missing data. Compare candidate signals against a manually calculated sample before evaluating performance. Track false-breakout rates using a fixed, predeclared definition, and compare net expectancy, drawdown, trade frequency and sensitivity to costs. A narrow channel can precede expansion, but it cannot identify the direction in advance.
If you need a customized Donchian indicator, breakout alert or strategy with consistent historical and real-time behavior, contact us for Custom Trading Software Development Services.
Risk disclosure: This article is educational, not investment advice. Examples are hypothetical; trading involves risk and losses may exceed planned stop risk. Past or simulated results do not guarantee future performance.