OPEN-SOURCE SCRIPT
ATR-limited Donchian Channel

The ATR-limited Donchian Channel is a modified version of the classic Donchian Channel that adapts more quickly to changing market conditions.
While a traditional Donchian Channel is based only on the highest high and lowest low over a given lookback period, this version introduces an ATR-based constraint that prevents the channel lines from extending too far away from price. This makes the channel more responsive and reduces lag compared to the standard Donchian Channel.

How it works
Why use this version?
Typical use cases
✅ This indicator is designed for traders who want the structure of a Donchian Channel but with an adaptive, volatility-sensitive adjustment that makes it react faster and more reliably than the classic version.
While a traditional Donchian Channel is based only on the highest high and lowest low over a given lookback period, this version introduces an ATR-based constraint that prevents the channel lines from extending too far away from price. This makes the channel more responsive and reduces lag compared to the standard Donchian Channel.
How it works
- The upper band is based on the highest high of the last N candles, but it cannot exceed a maximum distance of ATR × Factor above the current median price (midpoint of high and low).
- The lower band is based on the lowest low of the last N candles, but it cannot drop more than ATR × Factor below the median price.
- If the Donchian Channel would normally extend further than this ATR-limited boundary, the line is capped and marked in blue.
- Otherwise, the upper band is drawn in red and the lower band in green.
- A middle line is also plotted as the average of the modified upper and lower bands.
- An optional offset allows you to shift the channel backward or forward in time for easier visual alignment.
Why use this version?
- Faster reaction: By constraining the channel with ATR, the indicator adapts quicker to volatility changes and avoids long periods of overextended levels.
- Noise control: ATR filtering prevents extreme spikes or outlier highs/lows from stretching the channel unnecessarily.
- Visual clarity: Color-coding highlights when ATR filtering is active, making it easy to distinguish capped vs. natural Donchian levels.
Typical use cases
- Trend-following breakout systems, but with volatility-aware limits.
- Identifying dynamic support and resistance zones that adjust to market conditions.
- Filtering false breakouts by monitoring when the Donchian channel is capped by ATR.
✅ This indicator is designed for traders who want the structure of a Donchian Channel but with an adaptive, volatility-sensitive adjustment that makes it react faster and more reliably than the classic version.
オープンソーススクリプト
TradingViewの精神に則り、この作者はスクリプトのソースコードを公開しているので、その内容を理解し検証することができます。作者に感謝です!無料でお使いいただけますが、このコードを投稿に再利用する際にはハウスルールに従うものとします。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。
オープンソーススクリプト
TradingViewの精神に則り、この作者はスクリプトのソースコードを公開しているので、その内容を理解し検証することができます。作者に感謝です!無料でお使いいただけますが、このコードを投稿に再利用する際にはハウスルールに従うものとします。
免責事項
これらの情報および投稿は、TradingViewが提供または保証する金融、投資、取引、またはその他の種類のアドバイスや推奨を意図したものではなく、またそのようなものでもありません。詳しくは利用規約をご覧ください。