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. קרא עוד בתנאים וההגבלות.