← Script Marketplace
Open-source scriptindicator/v1

Donchian Channels

by Kodexius·@kodexius·

Plot the highest high, lowest low, and midpoint across a rolling price window.

#breakout#channel#donchian
Donchian Channels chart preview

Description

Donchian Channels define a rolling price range using the highest high and lowest low over the chosen period. The boundaries are commonly used to study breakouts, while the midpoint provides a simple measure of the range center.

Open-source script. Everyone can inspect the source code, use the script on a chart, and save an editable copy.

Release notes

Version history · 1 published version

Version 1CurrentChart updatedDonchian Channels · Aug 31, 2026
Release notes

Initial classic indicator release.

View current source ↓
Source codempl-2.0View source

indicator("Donchian Channels", { overlay: true });
const length = input.int("Length", 20, { min: 1, max: 500 });
const upper = highest(high, length);
const lower = lowest(low, length);
const basis = upper.map((v, i) => (v + lower[i]) / 2);
plot(upper, { title: "Upper", color: "#2962ff" });
plot(basis, { title: "Basis", color: "#ff9800" });
plot(lower, { title: "Lower", color: "#2962ff" });
fill(upper, lower, { color: "#2962ff", opacity: 0.08 });
  

Community discussion

0 comments

Loading…

No comments yet. Start the discussion.