OPEN-SOURCE SCRIPT

Smart Volatility Squeeze + Trend Filter

127
📌 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.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.