Donchian Channels
The highest high and lowest low of recent candles, as a channel.
Donchian channels over period candles that end from candles back: upper = highest high, lower = lowest low, middle = (upper + lower) ÷ 2. from = 1 (default) uses the previous candles only, the current candle is EXCLUDED (so close > upper is a breakout); from = 0 includes the current candle. Ready at period + from candles.
Settings
| Setting | Default | Range | What it does |
|---|---|---|---|
| period | 20 | 1 to 1000 | Candles in the window. |
| from | 1 | 0 to 1000 | Candles back where the window ends (1 = current excluded). |
What it gives
| Output | What it is |
|---|---|
| Upper channel | Highest high of the window. |
| Lower channel | Lowest low of the window. |
| Middle line | (upper + lower) ÷ 2. |
What it reads
It reads the whole candle (open, high, low, close and volume).
Warm-up
With its default settings, Donchian Channels needs 21 closed candles before its first value. A backtest loads them before its start date, so the first trade can already use it.
Test it
Copy this sentence into the Algonney chat to backtest it:
Backtest a strategy on BTC that uses Donchian Channels with its default settings