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.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.
오픈 소스 스크립트
트레이딩뷰의 진정한 정신에 따라, 이 스크립트의 작성자는 이를 오픈소스로 공개하여 트레이더들이 기능을 검토하고 검증할 수 있도록 했습니다. 작성자에게 찬사를 보냅니다! 이 코드는 무료로 사용할 수 있지만, 코드를 재게시하는 경우 하우스 룰이 적용된다는 점을 기억하세요.
면책사항
해당 정보와 게시물은 금융, 투자, 트레이딩 또는 기타 유형의 조언이나 권장 사항으로 간주되지 않으며, 트레이딩뷰에서 제공하거나 보증하는 것이 아닙니다. 자세한 내용은 이용 약관을 참조하세요.