The simplest envelope indicator possible: the upper band is the highest high over the lookback period, the lower band is the lowest low, the middle band is their midpoint. No smoothing, no math beyond max/min. The foundation of classic trend-following systems like the Turtle Traders' 20-day breakout strategy.
Donchian Channels(20) on MES daily — 20-day high breakout
What it measures
- Recent extremes. Where the highest high and lowest low have been over the lookback. Pure structural levels.
- Breakout reference. Price closing above the upper band means it's making a new period-high — the textbook breakout signal.
- Range bounds. The channel itself defines the recent trading range; the middle line is its midpoint.
Formula
How AlgoLift computes it
Upper Band = max(High over period)
Lower Band = min(Low over period)
Middle Band = (Upper + Lower) / 2
Width = Upper − Lower
That's it. No moving averages, no standard deviations, no ATR. Just the highest high and lowest low — which makes Donchian both the simplest envelope indicator and the most directly interpretable.
The %B output (price position within the channel) and slope of the middle band are computed for convenience.
Developed by Richard Donchian, the "father of trend following," in the mid-20th century. The 20-day Donchian breakout was the entry trigger in the famous Turtle Traders system.
Inputs in AlgoLift
| Setting | Default | Range | Notes |
|---|---|---|---|
| Period | 20 | 2–500 | Lookback for the highest high and lowest low. |
Recommended periods
- 10 (fast): Short-term breakout — frequent signals.
- 20 (default): Donchian's original — and the Turtle Traders' entry. Works on daily charts.
- 55: The Turtle Traders' exit period (and slower entry variant).
- 100+ (slow): Long-horizon breakout strategies on weekly bars.
Outputs in AlgoLift
| Handle | Type | Plotted | Notes |
|---|---|---|---|
| Upper Band | Numeric | Always | The highest high over the lookback. |
| Lower Band | Numeric | Always | The lowest low over the lookback. |
| Middle Band | Numeric | Always | Midpoint of upper and lower. |
| Channel Width | Numeric | On select | Upper − Lower. High width = high volatility; low width = consolidation. |
| %B | Numeric | On select | Position within the channel (0 = lower, 1 = upper, 0.5 = middle). |
| Slope | Numeric | On select | Rate of change of the middle band. |
Donchian Channels node — default state
How to read it
- Price closes above Upper Band: New high for the lookback — classic breakout signal.
- Price closes below Lower Band: New low for the lookback — breakdown signal.
- Price between bands: Inside the recent range — no breakout.
- Channel Width contracting: Recent volatility decreasing. Compressed range, possible setup for a breakout when it resolves.
- Channel Width expanding: Volatility increasing — current trend extending.
- %B near 0: Price near recent lows.
- %B near 1: Price near recent highs.
The Upper and Lower bands are stair-step functions — they hold a value until a new extreme is reached, then jump. This is different from smoothed indicators (Bollinger, Keltner) where the bands change every bar.
Donchian's value is its simplicity. The upper and lower bands aren't statistical abstractions — they're literally the highest high and lowest low. Breakouts above or below mean exactly what they look like. No interpretation needed.
Best in / worst in
Best in trending markets, on liquid instruments with clear breakout/breakdown dynamics, and as the foundation for trend-following systems. The simplicity is a feature, not a limitation.
Worst in range-bound markets (breakouts fail constantly), and on very-low-volume instruments where a single thin-liquidity bar can set a "new high" that doesn't represent real demand.
Three setups
1. The classic 20-day breakout (Turtle Trader entry)
The most famous Donchian setup.
- Long: Price closes above the previous bar's Upper Band (not the current bar's, which would be circular). I.e.,
Close[t] > UpperBand[t−1]. - Short: Price closes below the previous bar's Lower Band.
Use a different exit period — the Turtles used 10 for exits (close out longs when price closes below the 10-bar low). Combine with position sizing based on ATR for the complete original system.
20-day Donchian breakout with BarsAgo comparison
2. Channel width compression entry
Trade breakouts only after volatility has compressed.
- Setup condition: Channel Width has been below its 50-bar average for at least 10 consecutive bars (consolidation).
- Long: Setup condition AND price closes above Upper Band.
- Short: Setup condition AND price closes below Lower Band.
The compression filter dramatically reduces false breakouts from random spikes.
3. Multi-Donchian system
Use two Donchian channels at different periods.
- Slow Donchian(55): Defines regime — current Upper > previous Upper(55) for 55 bars = bullish regime.
- Fast Donchian(20): Provides entry trigger.
- Long: In bullish regime AND price > Donchian(20) Upper. Exit when price < Donchian(20) Lower.
- Short: Symmetric.
The slow channel filters out the worst false signals from the fast channel.
Advanced patterns in AlgoLift
Donchian as an ATR-free trailing stop. In a long trade, use the current Lower Band as the trailing stop (it only moves up, never down, as new lows fall out of the lookback). Wire via Set Stop Loss. Functions like Parabolic SAR but simpler — no acceleration parameter to tune.
Channel width for position sizing. Scale position size inversely to Channel Width — narrow channel (consolidation, low risk per bar) = larger size, wide channel (volatility expansion, high risk per bar) = smaller size. The math automatically right-sizes for current conditions.
Donchian breakout + Cooldown. Pair the breakout entry with a Cooldown that prevents re-entry until price has pulled back inside the channel. Eliminates machine-gun re-entries on the same breakout level.
Donchian for instrument screening. Compute Channel Width on multiple instruments via Data Source nodes. Trade only the 2-3 instruments with the lowest Width (most compressed) — these are the highest-probability breakout candidates. See strategy correlation.
Common mistakes
- Using the current bar's band in the comparison.
Close > UpperBand[current]is circular — the band is defined to include the current bar. Always useBarsAgo Modifierto compare againstUpperBand[t−1]. - Trading every breakout in chop. Donchian breakouts in range-bound markets fail constantly. Pair with a regime filter (ADX, KAMA Efficiency Ratio) or only run during known-trending periods.
- Skipping the exit period. The Turtle system uses different periods for entry (20) and exit (10). Using the same period for both creates symmetric whipsaw behavior. Different periods preserve the trend-following character.
- Treating Donchian as a mean-reversion tool. Donchian's structure (no smoothing, hard extremes) is designed for breakouts. Mean reversion uses Bollinger or Keltner instead.