# Donchian Channels

Donchian Channels is an indicator on [Vela](https://vela.luxalgo.com/chart), our next-generation charting platform, written in Pine Script®.

Donchian Channels plot the highest high and lowest low over a 20-bar lookback as upper and lower bands, with a midline halfway between them; the same construction is often called a Price Channel. The bands mark the recent price extremes that breakout approaches reference. This is the raw standard calculation with the classic length of 20.

- Indicator in the LuxAlgo Library, by LuxAlgo, published Apr 13, 2020.
- Access: free.
- Concepts: [Donchian Channels](https://www.luxalgo.com/library/concept/donchian-channels/) (primary)
- Open on Vela: https://vela.luxalgo.com/chart?pineScriptCodeId=i9hvlapqh5z4kli0099s6n71
- Page: https://www.luxalgo.com/library/indicator/donchian-channels/

**Donchian Channels** plot the highest high and lowest low of the last 20 bars as upper and lower bands, with a midline halfway between them, the construction often called a Price Channel. The bands mark the exact levels where price prints a fresh 20-bar extreme, referenced by breakout approaches since Richard Donchian's early trend-following work: a push through the upper band is, by definition, a new high.

This is the raw standard calculation with the classic length of 20. The Upper and Lower bands draw as lines with a subtle fill between them; the Middle line (the average of the two) plots as circles.

## How to Trade the Donchian Channels?

- **Close above the prior bar's upper band**: a new 20-bar high, the classic long breakout; the build fires its Breakout Up alert on this cross.
- **Close below the prior bar's lower band**: a new 20-bar low, covered by the Breakout Down alert.
- **Bands ratcheting one way while price rides that band**: the footprint of a persistent trend; the far band doubles as a trailing exit.
- **Both bands flat**: no new extremes on either side, a range with objectively marked boundaries.
- **The Middle line**: a pullback reference in trends, a fade target inside flat channels.

The current bar's high and low are part of the window, so price can never poke outside its own channel intrabar. Breakouts are judged against the previous bar's bands, exactly how the alerts are evaluated.

## Donchian Channels Settings

- **Length** (default 20): the lookback for the highest high and lowest low. Longer demands rarer extremes: fewer, later breakouts and a wider channel; shorter reacts sooner and whipsaws more in congestion. The Upper, Middle, Lower, and Fill inputs only control colors.

## Frequently Asked Questions

### How do Donchian Channels differ from Bollinger Bands?

Bollinger Bands wrap a standard-deviation envelope around a moving average, so they express typical dispersion and price closes outside them routinely. Donchian Channels contain no averaging or volatility math: the bands are literal N-bar extremes. Bollinger asks "is this move unusual?"; Donchian asks "is this a new extreme?".

### Why does price never break the channel on the current bar?

Because the window includes the bar being drawn: the moment a new high prints, the upper band moves up with it. A property of the construction, not a flaw. Hence the standard breakout test, used by this build's alerts, compares the close against the channel one bar back.

### What length should I use?

The default of 20 is the classic reference setting. Systematic trend followers historically ran a longer channel for entries and a shorter one for exits; with one Length, raise it to filter noise, lower it to react earlier but accept more false breaks.

## Related indicators

- [Donchian MA Bands](https://www.luxalgo.com/library/indicator/donchian-ma-bands/) (Donchian Channels): markdown at https://www.luxalgo.com/library/indicator/donchian-ma-bands.md
- [Donchian Zig-Zag](https://www.luxalgo.com/library/indicator/donchian-zig-zag/) (Donchian Channels): markdown at https://www.luxalgo.com/library/indicator/donchian-zig-zag.md
- [Nadaraya-Watson Envelope](https://www.luxalgo.com/library/indicator/nadaraya-watson-envelope/) (Envelope): markdown at https://www.luxalgo.com/library/indicator/nadaraya-watson-envelope.md
- [TTM Squeeze](https://www.luxalgo.com/library/indicator/ttm-squeeze/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/ttm-squeeze.md
- [Fibonacci Bollinger Bands](https://www.luxalgo.com/library/indicator/fibonacci-bollinger-bands/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/fibonacci-bollinger-bands.md
- [Double Bollinger Zones](https://www.luxalgo.com/library/indicator/double-bollinger-zones/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/double-bollinger-zones.md
- [Proximal Range Filter](https://www.luxalgo.com/library/indicator/proximal-range-filter/) (Envelope): markdown at https://www.luxalgo.com/library/indicator/proximal-range-filter.md
- [Bollinger Squeeze](https://www.luxalgo.com/library/indicator/bollinger-squeeze/) (Volatility): markdown at https://www.luxalgo.com/library/indicator/bollinger-squeeze.md

---

Source: https://www.luxalgo.com/library/indicator/donchian-channels/ (LuxAlgo Library). Free to use with attribution: https://www.luxalgo.com/library/license/
