How it is calculated
The upper line is the highest high and the lower line the lowest low of the last length bars, the current bar included. The middle line is their average. There is no smoothing; the first value comes once the length is filled. After Richard Donchian, with TA-Lib MAX and MIN.
Reference: Donchian channels (TA-Lib MAX and MIN)
How to read it
A rising upper line means price made a new high for the period, the classic breakout. The lines stay flat while nothing new happens and jump when an old extreme leaves the window. Since the current bar is in the window, its high can never lie above its own upper line.
In a strategy
A breakout system in the style of the Turtles: buy when the high exceeds the upper line of the bar before, ctx.ind("dc", length=20).upper read one bar earlier, and exit on the lower line of a shorter channel.
Inputs
| Input | Type | Default | Range or choices |
|---|---|---|---|
Lengthlength | Whole number | 20 | min 1, max 5000 |
What it draws
| Line | Drawn as |
|---|---|
| Upper | Line |
| Middle | Line |
| Lower | Line |
Used in
No strategy template reads it yet.