OPEN-SOURCE SCRIPT
SMA Squeeze Oscillator

█ OVERVIEW
SMA Squeeze Oscillator is a momentum oscillator based on the relationship between multiple SMA moving averages. It combines volatility compression analysis (Squeeze), wave-style momentum structure, trend filtering, breakout signals, and divergence detection.
The indicator is designed to identify periods of market compression (low volatility), which are often followed by dynamic price moves. Additionally, it visualizes momentum and trend structure in a clean and readable way, without using a classic histogram.
█ CONCEPT
The core of the indicator is built on three SMA moving averages with different lengths. The distance between them (spread) is compared to ATR, which allows the detection of volatility compression (Squeeze).
- When the SMA spread is smaller than ATR × multiplier, the market is considered to be in Squeeze
- When the spread expands beyond this threshold, the market exits the Squeeze – often signaling the beginning of an impulse
Momentum is calculated from the relationship between the faster SMA and the slower SMAs, then smoothed. Instead of a traditional histogram, the indicator displays continuous momentum waves above and below the zero line, making changes in momentum structure easier to read.
An optional SMA trend filter can be used to limit signals to the direction of the current trend.

█ FEATURES
Calculations
- three SMA moving averages
- ATR as a volatility measure
- Squeeze detection based on SMA spread
- wave-based momentum oscillator with smoothing
- optional SMA trend filter
Visualization
- momentum waves above / below the zero line
- bullish / bearish trend fills
- separate fill and color for Squeeze phases
- thick zero line reflecting current trend
- wave-style candle coloring based on momentum
- first wave markers after exiting Squeeze
- bullish and bearish divergence visualization
Signals
- momentum zero-line cross (Bull / Bear Cross)
- first momentum wave after Squeeze
- classic bullish and bearish divergences
Alerts
- Bull Cross
- Bear Cross
- First Bullish after Squeeze
- First Bearish after Squeeze
- Bullish Divergence
- Bearish Divergence
█ HOW TO USE
Adding the indicator
Paste the code into Pine Editor or search for “SMA Squeeze Oscillator” on TradingView.
Main settings
- SMA 1 / 2 / 3 – lengths of SMAs used for Squeeze and momentum
- ATR Length / Multiplier – Squeeze detection sensitivity
- ATR Multiplier = 0 → the indicator does not display Squeeze zones
- Momentum Smoothing – smoothing of momentum waves
- Enable SMA Filter – trend filter
- the current trend is reflected by the zero-line color
- price below SMA → bearish trend
- price above SMA → bullish trend
- when enabled, it filters Bull / Bear Cross and First Bullish / Bearish after Squeeze signals, allowing only those aligned with the trend
- Enable candle coloring – wave-style candle coloring
- Enable Divergence – divergence detection
█ APPLICATION
Squeeze & Breakout
Squeeze phases indicate low volatility and energy accumulation. A breakout from Squeeze often leads to a strong directional move.
The SMA filter is not required – instead, users may apply:
- a more advanced trend filter
- structural confirmation (level break, correction completion)
- additional price-action tools
Momentum trading
The direction and slope of momentum waves help assess impulse strength and loss of momentum.
A momentum reversal can act as an early signal of a correction or potential trend change, often before it becomes visible on price.
Divergences
The indicator detects classic bullish and bearish divergences.
Important notes:
- divergences appear with a delay equal to the pivot length required for detection, by default, this delay is two candles
- divergences forming on small momentum waves or inside a Squeeze are often misleading and should be treated with caution
█ NOTES
- the indicator works best when used in market context
- Squeeze reflects volatility, not direction
- it is not a standalone trading system
SMA Squeeze Oscillator is a momentum oscillator based on the relationship between multiple SMA moving averages. It combines volatility compression analysis (Squeeze), wave-style momentum structure, trend filtering, breakout signals, and divergence detection.
The indicator is designed to identify periods of market compression (low volatility), which are often followed by dynamic price moves. Additionally, it visualizes momentum and trend structure in a clean and readable way, without using a classic histogram.
█ CONCEPT
The core of the indicator is built on three SMA moving averages with different lengths. The distance between them (spread) is compared to ATR, which allows the detection of volatility compression (Squeeze).
- When the SMA spread is smaller than ATR × multiplier, the market is considered to be in Squeeze
- When the spread expands beyond this threshold, the market exits the Squeeze – often signaling the beginning of an impulse
Momentum is calculated from the relationship between the faster SMA and the slower SMAs, then smoothed. Instead of a traditional histogram, the indicator displays continuous momentum waves above and below the zero line, making changes in momentum structure easier to read.
An optional SMA trend filter can be used to limit signals to the direction of the current trend.
█ FEATURES
Calculations
- three SMA moving averages
- ATR as a volatility measure
- Squeeze detection based on SMA spread
- wave-based momentum oscillator with smoothing
- optional SMA trend filter
Visualization
- momentum waves above / below the zero line
- bullish / bearish trend fills
- separate fill and color for Squeeze phases
- thick zero line reflecting current trend
- wave-style candle coloring based on momentum
- first wave markers after exiting Squeeze
- bullish and bearish divergence visualization
Signals
- momentum zero-line cross (Bull / Bear Cross)
- first momentum wave after Squeeze
- classic bullish and bearish divergences
Alerts
- Bull Cross
- Bear Cross
- First Bullish after Squeeze
- First Bearish after Squeeze
- Bullish Divergence
- Bearish Divergence
█ HOW TO USE
Adding the indicator
Paste the code into Pine Editor or search for “SMA Squeeze Oscillator” on TradingView.
Main settings
- SMA 1 / 2 / 3 – lengths of SMAs used for Squeeze and momentum
- ATR Length / Multiplier – Squeeze detection sensitivity
- ATR Multiplier = 0 → the indicator does not display Squeeze zones
- Momentum Smoothing – smoothing of momentum waves
- Enable SMA Filter – trend filter
- the current trend is reflected by the zero-line color
- price below SMA → bearish trend
- price above SMA → bullish trend
- when enabled, it filters Bull / Bear Cross and First Bullish / Bearish after Squeeze signals, allowing only those aligned with the trend
- Enable candle coloring – wave-style candle coloring
- Enable Divergence – divergence detection
█ APPLICATION
Squeeze & Breakout
Squeeze phases indicate low volatility and energy accumulation. A breakout from Squeeze often leads to a strong directional move.
The SMA filter is not required – instead, users may apply:
- a more advanced trend filter
- structural confirmation (level break, correction completion)
- additional price-action tools
Momentum trading
The direction and slope of momentum waves help assess impulse strength and loss of momentum.
A momentum reversal can act as an early signal of a correction or potential trend change, often before it becomes visible on price.
Divergences
The indicator detects classic bullish and bearish divergences.
Important notes:
- divergences appear with a delay equal to the pivot length required for detection, by default, this delay is two candles
- divergences forming on small momentum waves or inside a Squeeze are often misleading and should be treated with caution
█ NOTES
- the indicator works best when used in market context
- Squeeze reflects volatility, not direction
- it is not a standalone trading system
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.
Skrypt open-source
W zgodzie z duchem TradingView twórca tego skryptu udostępnił go jako open-source, aby użytkownicy mogli przejrzeć i zweryfikować jego działanie. Ukłony dla autora. Korzystanie jest bezpłatne, jednak ponowna publikacja kodu podlega naszym Zasadom serwisu.
Wyłączenie odpowiedzialności
Informacje i publikacje nie stanowią i nie powinny być traktowane jako porady finansowe, inwestycyjne, tradingowe ani jakiekolwiek inne rekomendacje dostarczane lub zatwierdzone przez TradingView. Więcej informacji znajduje się w Warunkach użytkowania.