Cookbook
Donchian channel
Highest high and lowest low of N bars.
//@zscript 1
indicator("Donchian", overlay=true)
n = input.int(20, "Length", minval=2)
hi = ta.highest(high, n)
lo = ta.lowest(low, n)
p1 = plot(hi, "High", color=color.green)
p2 = plot(lo, "Low", color=color.red)
fill(p1, p2, color.new(color.gray, 94))
How it works
A breakout channel: a close above the top line is a new N-bar high.
Education only. Not financial advice. Examples are teaching samples, not trading results.
