Donchian Channels explained, and how to write them as a condition
Donchian Channels are the simplest channel there is: the highest high and the lowest low of the last N bars, drawn as two lines. No average, no multiplier. They exist for one condition — price closing beyond the range it has held — and that is the condition the app offers.
What they measure
The upper line is the highest high of the last N bars, twenty by default; the lower line is the lowest low. Both step rather than glide: the upper line only rises when a bar sets a new high, and only falls when the old high drops out of the window. In between it is flat.
One detail matters for the condition. The channel on each bar is built from the N bars before it, not including it. If the current bar were included, its own high would be part of the upper line and price could never close above the channel — the line would move up with it. Leaving the current bar out is what makes "breaks above" possible.
The one setting
The period. Twenty is the default and the classic value; fifty-five is the other one people reach for, from the trend-following systems the channel is best known for. A longer period means a break is a rarer and larger event — the close has to clear a high that has stood for longer. Counted in bars of the timeframe the condition reads.
Writing them as a condition
Two comparisons, in the builder's own words. Both are moments.
- Price breaks above. The previous bar closed at or below the upper line and this one closed above it. Judged on the close, so a wick through the line that closes back inside does not count. True only on the bar of the break.
- Price breaks below. The same at the lower line.
Donchian(20) on 1d · price breaks above
Read it as a sentence: on the daily chart, today's close is above the highest high of the previous twenty days, and yesterday's was not. That is what the scanner evaluates at each daily close.
What a break is, and is not
A twenty-bar break says price is somewhere it has not been for twenty bars. It does not say the move will continue; on a market that ranges, most breaks are followed by a return inside, and a strategy built on them spends its time being wrong by a little in exchange for being right by a lot occasionally. That is the shape of the trend-following systems this channel comes from, and whether it holds on your market is exactly what a backtest over a long window shows. The entry check is the quicker first look: did the bars after a break drift any differently from the bars after a random moment?
Before you trust them
Run an entry check. It will tell you whether, on the market you care about, the moments this condition fired moved any differently from a random moment over the history tested. That is a fact about the past on that market, and it is the only kind of fact a test here produces.