OPEN-SOURCE SCRIPT
Adaptive Volatility Bands [I.M]

Adaptive Volatility Bands [I.M]
A clean, directional volatility envelope that visually highlights the dominant side of the market. Instead of showing bands on both sides at once, AVB displays a single trailing gradient band that flips with the trend — acting as dynamic support during uptrends and dynamic resistance during downtrends.
▶ HOW IT WORKS
1. CENTER LINE
A double-smoothed baseline (WMA → EMA) defines the underlying trend. Its slope determines whether the market is in bullish or bearish mode.
2. TRAILING BAND
A single ATR-based band is plotted on the dominant side:
- Uptrend → band sits BELOW price (support zone)
- Downtrend → band sits ABOVE price (resistance zone)
3. GRADIENT FILL
The space between the trailing band and price is filled with 8 progressive transparency layers, creating a smooth gradient that fades toward the candles. This makes the trend visually unambiguous at a glance.
▶ HOW TO USE IT
The core principle is simple: TRADE WITH THE BAND, NEVER AGAINST IT.
When the band is GREEN (below price):
- The market is in an uptrend
- Look for LONG entries on pullbacks toward the band
- The trailing band acts as a dynamic stop-loss reference
- Avoid shorting until the band flips to red above price
When the band is RED (above price):
- The market is in a downtrend
- Look for SHORT entries on rallies toward the band
- The trailing band acts as a dynamic stop-loss reference
- Avoid longs until the band flips to green below price
TREND FLIPS: When the band switches sides, treat it as a regime change. Wait for confirmation (a clean close on the new side) before committing — the first bars after a flip are noisy.
▶ SETTINGS
- Length / Smoothing: control baseline responsiveness
- ATR Length: volatility lookback for band distance
- Band Distance (ATR): how far the band sits from the baseline (default 2.0)
- Gradient Layers: smoothness of the fill (3–15)
- Up / Down Colors: fully customizable
▶ ALERTS
- Bullish / Bearish baseline crosses
- Trend flip to bullish / bearish
▶ NOTES
This indicator is a visual trend filter, not a standalone signal generator. It works best when combined with momentum or volume confirmation. The unilateral design is intentional — it forces directional discipline and discourages counter-trend trading.
Open-source. Feedback and forks welcome.
A clean, directional volatility envelope that visually highlights the dominant side of the market. Instead of showing bands on both sides at once, AVB displays a single trailing gradient band that flips with the trend — acting as dynamic support during uptrends and dynamic resistance during downtrends.
▶ HOW IT WORKS
1. CENTER LINE
A double-smoothed baseline (WMA → EMA) defines the underlying trend. Its slope determines whether the market is in bullish or bearish mode.
2. TRAILING BAND
A single ATR-based band is plotted on the dominant side:
- Uptrend → band sits BELOW price (support zone)
- Downtrend → band sits ABOVE price (resistance zone)
3. GRADIENT FILL
The space between the trailing band and price is filled with 8 progressive transparency layers, creating a smooth gradient that fades toward the candles. This makes the trend visually unambiguous at a glance.
▶ HOW TO USE IT
The core principle is simple: TRADE WITH THE BAND, NEVER AGAINST IT.
When the band is GREEN (below price):
- The market is in an uptrend
- Look for LONG entries on pullbacks toward the band
- The trailing band acts as a dynamic stop-loss reference
- Avoid shorting until the band flips to red above price
When the band is RED (above price):
- The market is in a downtrend
- Look for SHORT entries on rallies toward the band
- The trailing band acts as a dynamic stop-loss reference
- Avoid longs until the band flips to green below price
TREND FLIPS: When the band switches sides, treat it as a regime change. Wait for confirmation (a clean close on the new side) before committing — the first bars after a flip are noisy.
▶ SETTINGS
- Length / Smoothing: control baseline responsiveness
- ATR Length: volatility lookback for band distance
- Band Distance (ATR): how far the band sits from the baseline (default 2.0)
- Gradient Layers: smoothness of the fill (3–15)
- Up / Down Colors: fully customizable
▶ ALERTS
- Bullish / Bearish baseline crosses
- Trend flip to bullish / bearish
▶ NOTES
This indicator is a visual trend filter, not a standalone signal generator. It works best when combined with momentum or volume confirmation. The unilateral design is intentional — it forces directional discipline and discourages counter-trend trading.
Open-source. Feedback and forks welcome.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.
סקריפט קוד פתוח
ברוח האמיתית של TradingView, יוצר הסקריפט הזה הפך אותו לקוד פתוח, כך שסוחרים יוכלו לעיין בו ולאמת את פעולתו. כל הכבוד למחבר! אמנם ניתן להשתמש בו בחינם, אך זכור כי פרסום חוזר של הקוד כפוף ל־כללי הבית שלנו.
כתב ויתור
המידע והפרסומים אינם מיועדים להיות, ואינם מהווים, ייעוץ או המלצה פיננסית, השקעתית, מסחרית או מכל סוג אחר המסופקת או מאושרת על ידי TradingView. קרא עוד ב־תנאי השימוש.