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 อ่านเพิ่มเติมใน ข้อกำหนดการใช้งาน