OPEN-SOURCE SCRIPT
Squeeze Momentum Long-Only Strategy v5

This strategy is a refined long-only version of the popular Squeeze Momentum Indicator by LazyBear, enhanced with modern multi-filter techniques for improved precision and robustness.
📈 Core Idea
The strategy aims to capture explosive upside moves after periods of low volatility ("squeeze") — confirmed by breakout momentum, strong volume, macro trend alignment, and market context. Trades are entered only long, making it suitable for bullish assets or trending environments like crypto.
🔍 How It Works
1. Squeeze Detection
Detects a "squeeze" condition when Bollinger Bands (BB) contract inside Keltner Channels (KC).
A squeeze releases (entry signal) when BB expand outside KC — implying a potential breakout.
text
Copy
Edit
sqzOff → Squeeze released → Price may expand directionally
2. Momentum Filter (Modified Squeeze Histogram)
Uses a custom linear regression-based histogram (val) to gauge price momentum.
Only enters long when:
val > 0 (bullish momentum)
val is rising for two consecutive bars (to avoid false starts)
val exceeds a configurable threshold
3. Volume Filter
Confirms strength of breakout by requiring:
text
Copy
Edit
Current volume > Volume Moving Average × Multiplier
This ensures that breakouts are backed by real participation, reducing weak or manipulated moves.
4. Trend Filter (HTF SMA)
Uses a higher timeframe (e.g., Daily) Simple Moving Average to define trend bias.
Only takes long trades if price is above the selected trend SMA (e.g., 50-period SMA on D timeframe).
Helps avoid countertrend trades during bear phases or consolidations.
5. Volatility Filter
Uses ATR to measure recent volatility.
Filters out periods of low ATR to avoid trading in choppy, compressed markets.
🎯 Entry Conditions (All Must Be True):
Squeeze releases upward (sqzOff)
Momentum (val) is positive and rising (2-bar confirmation)
Momentum exceeds a minimum strength threshold
Volume spikes above average
Price is above HTF trend SMA
ATR is above its moving average (indicating active market)
🏁 Exit Condition
Closes the trade only when val < 0 → Momentum flips bearish.
(Optional extensions like trailing stops or take-profit rules can be added.)
⚙️ Customization Options
Momentum strength threshold
Volume multiplier
ATR length & filter threshold
HTF trend timeframe (e.g., "D", "3D", "W")
Trend SMA length
KC/BB settings for squeeze tuning
📊 Best Use Cases
Crypto (BTC, ETH, altcoins in uptrends)
Equities in trending sectors
Avoid in sideways, illiquid, or heavily news-driven markets
✅ Benefits
High precision due to multi-layered confirmation
Avoids overtrading in poor conditions
Focuses on clean, high-quality breakout trades
Flexible for risk management add-ons
📈 Core Idea
The strategy aims to capture explosive upside moves after periods of low volatility ("squeeze") — confirmed by breakout momentum, strong volume, macro trend alignment, and market context. Trades are entered only long, making it suitable for bullish assets or trending environments like crypto.
🔍 How It Works
1. Squeeze Detection
Detects a "squeeze" condition when Bollinger Bands (BB) contract inside Keltner Channels (KC).
A squeeze releases (entry signal) when BB expand outside KC — implying a potential breakout.
text
Copy
Edit
sqzOff → Squeeze released → Price may expand directionally
2. Momentum Filter (Modified Squeeze Histogram)
Uses a custom linear regression-based histogram (val) to gauge price momentum.
Only enters long when:
val > 0 (bullish momentum)
val is rising for two consecutive bars (to avoid false starts)
val exceeds a configurable threshold
3. Volume Filter
Confirms strength of breakout by requiring:
text
Copy
Edit
Current volume > Volume Moving Average × Multiplier
This ensures that breakouts are backed by real participation, reducing weak or manipulated moves.
4. Trend Filter (HTF SMA)
Uses a higher timeframe (e.g., Daily) Simple Moving Average to define trend bias.
Only takes long trades if price is above the selected trend SMA (e.g., 50-period SMA on D timeframe).
Helps avoid countertrend trades during bear phases or consolidations.
5. Volatility Filter
Uses ATR to measure recent volatility.
Filters out periods of low ATR to avoid trading in choppy, compressed markets.
🎯 Entry Conditions (All Must Be True):
Squeeze releases upward (sqzOff)
Momentum (val) is positive and rising (2-bar confirmation)
Momentum exceeds a minimum strength threshold
Volume spikes above average
Price is above HTF trend SMA
ATR is above its moving average (indicating active market)
🏁 Exit Condition
Closes the trade only when val < 0 → Momentum flips bearish.
(Optional extensions like trailing stops or take-profit rules can be added.)
⚙️ Customization Options
Momentum strength threshold
Volume multiplier
ATR length & filter threshold
HTF trend timeframe (e.g., "D", "3D", "W")
Trend SMA length
KC/BB settings for squeeze tuning
📊 Best Use Cases
Crypto (BTC, ETH, altcoins in uptrends)
Equities in trending sectors
Avoid in sideways, illiquid, or heavily news-driven markets
✅ Benefits
High precision due to multi-layered confirmation
Avoids overtrading in poor conditions
Focuses on clean, high-quality breakout trades
Flexible for risk management add-ons
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.
Script open-source
In pieno spirito TradingView, il creatore di questo script lo ha reso open-source, in modo che i trader possano esaminarlo e verificarne la funzionalità. Complimenti all'autore! Sebbene sia possibile utilizzarlo gratuitamente, ricorda che la ripubblicazione del codice è soggetta al nostro Regolamento.
Declinazione di responsabilità
Le informazioni ed i contenuti pubblicati non costituiscono in alcun modo una sollecitazione ad investire o ad operare nei mercati finanziari. Non sono inoltre fornite o supportate da TradingView. Maggiori dettagli nelle Condizioni d'uso.