OPEN-SOURCE SCRIPT
Smart Volatility Squeeze + Trend Filter

📌 Purpose
This indicator detects volatility squeeze conditions when Bollinger Bands contract inside Keltner Channels and signals potential breakout opportunities.
It also includes an optional EMA-based trend filter to align signals with the dominant market direction.
🧠 How It Works
1. Squeeze Condition
Bollinger Bands (BB): Length = 20, StdDev = 2.0 (default)
Keltner Channels (KC): EMA Length = 20, ATR Multiplier = 1.5 (default)
Squeeze ON: Occurs when BB Upper < KC Upper and BB Lower > KC Lower (low volatility zone).
2. Breakout Signals
Long Breakout: Price crosses above BB Upper after squeeze.
Short Breakout: Price crosses below BB Lower after squeeze.
3. Trend Filter (optional)
EMA(50) used to confirm breakout direction:
Long signals allowed only if price > EMA(50)
Short signals allowed only if price < EMA(50)
Toggle Use Trend Filter to enable/disable.
4. Visual & Alerts
Green circle at chart bottom indicates Squeeze ON.
Green/Red triangles mark breakouts.
Background gradually brightens during squeeze buildup.
Alerts available for long and short breakouts.
📈 How to Use
Look for Squeeze ON → then wait for breakout arrows.
Trade in breakout direction, preferably with trend filter ON.
Works best on higher timeframes (1h, 4h, D) and trending markets.
Markets: Crypto, Forex, Stocks — effective in volatile assets.
⚙️ Inputs
BB Length / StdDev
KC EMA Length / ATR Multiplier
Use Trend Filter
Trend EMA Length
⚠️ Disclaimer
This script is for educational purposes only. It does not constitute financial advice.
Always test thoroughly before live trading.
This indicator detects volatility squeeze conditions when Bollinger Bands contract inside Keltner Channels and signals potential breakout opportunities.
It also includes an optional EMA-based trend filter to align signals with the dominant market direction.
🧠 How It Works
1. Squeeze Condition
Bollinger Bands (BB): Length = 20, StdDev = 2.0 (default)
Keltner Channels (KC): EMA Length = 20, ATR Multiplier = 1.5 (default)
Squeeze ON: Occurs when BB Upper < KC Upper and BB Lower > KC Lower (low volatility zone).
2. Breakout Signals
Long Breakout: Price crosses above BB Upper after squeeze.
Short Breakout: Price crosses below BB Lower after squeeze.
3. Trend Filter (optional)
EMA(50) used to confirm breakout direction:
Long signals allowed only if price > EMA(50)
Short signals allowed only if price < EMA(50)
Toggle Use Trend Filter to enable/disable.
4. Visual & Alerts
Green circle at chart bottom indicates Squeeze ON.
Green/Red triangles mark breakouts.
Background gradually brightens during squeeze buildup.
Alerts available for long and short breakouts.
📈 How to Use
Look for Squeeze ON → then wait for breakout arrows.
Trade in breakout direction, preferably with trend filter ON.
Works best on higher timeframes (1h, 4h, D) and trending markets.
Markets: Crypto, Forex, Stocks — effective in volatile assets.
⚙️ Inputs
BB Length / StdDev
KC EMA Length / ATR Multiplier
Use Trend Filter
Trend EMA Length
⚠️ Disclaimer
This script is for educational purposes only. It does not constitute financial advice.
Always test thoroughly before live trading.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.
Open-source script
In true TradingView spirit, the creator of this script has made it open-source, so that traders can review and verify its functionality. Kudos to the author! While you can use it for free, remember that republishing the code is subject to our House Rules.
Disclaimer
The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.