- Price Channel tracks the highest high and lowest low over a lookback period with a midpoint average, creating a three-line price envelope that defines where the market has been.
- **Similar:** [DC](../dc/dc.md), [MMChannel](../mmchannel/mmchannel.md) | **Complementary:** Volume confirmation on breakouts | **Trading note:** Price channel based on percentage offset from midpoint.
Price Channel tracks the highest high and lowest low over a lookback period with a midpoint average, creating a three-line price envelope that defines where the market has been. Functionally identical to Donchian Channels, the indicator uses actual price extremes rather than volatility estimates, producing bands that represent real support and resistance levels. This implementation uses monotonic deques for O(1) amortized updates instead of the naive O(n) rescan that most platforms use internally.
Price Channel is the generic name for what Richard Donchian formalized in the 1960s while managing one of the first publicly held commodity funds. The indicator appears under various aliases: Donchian Channels, N-period high/low channels, or breakout bands.
The "4-week rule" (buy on 20-day high, sell on 20-day low) became the foundation for systematic trend-following. The indicator gained fame through the Turtle Trading experiment in 1983, when Richard Dennis and William Eckhardt recruited novice traders and taught them a mechanical system built on channel breakouts. The Turtles reportedly earned over \$100 million using entry signals on 20-day breakouts with exits on 10-day counter-breakouts.
Most implementations compute max/min by scanning the entire lookback window on every bar: $O(n)$ per update, $O(n^2)$ for a series. This works for period 20 but becomes costly for longer windows or real-time feeds. The monotonic deque approach maintains running max/min in $O(1)$ amortized time, enabling period 500+ without performance degradation.
where $H$ is the high price and $n$ is the period. The upper band moves up immediately on a new high but only drops when the previous highest high exits the lookback window.
On each bar: (1) expire stale front indices outside the window, (2) remove back elements superseded by the new value, (3) push the new index to the back.
Streaming: $O(1)$ amortized per bar. Each element enters and exits each deque at most once. Memory: two circular buffers of $n$ floats plus two deques of at most $n$ indices.
Identical to DC in cost. Each element enters and exits each deque exactly once over the full series, yielding $O(N)$ total work across $N$ bars regardless of period.