indicator · on price · open source

Donchian Channel indicator

Donchian Channel is a free open-source indicator by @deepwick. Donchian Channel is the classic turtle-trader band: upper rail = highest high of the… Deepwick Script runs a subset of Pine Script.

Deepwick · @deepwickv1Updated 3 Nov 2026▲ 0 users
Running…
Loading chart…

What Donchian Channel does

Donchian Channel is the classic turtle-trader band: upper rail = highest high of the lookback, lower rail = lowest low.

  • Breakouts above/below the rails are the original trend entries.
  • A flat channel (rails pinned) = range regime; ride the rails back to the middle.

Source code

Deepwick Script, a subset of Pine Script · read-only

//@version=6
indicator("Donchian Channel", overlay=true)
len = input.int(20, "Lookback length", minval=2, maxval=200)
colorUp = input.color("color.green", "Color  Up")
colorMid = input.color("color.orange", "Color  Mid")
colorDown = input.color("color.red", "Color  Down")
upper = ta.highest(high, len)
lower = ta.lowest(low, len)
mid = (upper + lower) / 2
p_DC_Upper = plot(upper, "DC Upper", color=colorUp)
p_DC_Mid = plot(mid, "DC Mid", color=colorMid, style=plot.style_linebr)
p_DC_Lower = plot(lower, "DC Lower", color=colorDown)
fill(p_DC_Upper, p_DC_Lower, color=color.new(colorMid, 92))
alertcondition(ta.crossover(close, upper), "Upper breakout", "Close broke above the Donchian upper rail")
alertcondition(ta.crossunder(close, lower), "Lower breakdown", "Close broke below the Donchian lower rail")

Comments

No comments yet.

Sign in to comment.