Adaptive Squeeze Momentum Pro [WillyAlgoTrader]Adaptive Squeeze Momentum Pro is a non-overlay oscillator that combines volatility compression detection (squeeze) with an ATR-normalized momentum histogram and built-in divergence scanning — providing three layers of analysis in a single pane: when the market is coiling (squeeze), which direction the energy is building (momentum), and when momentum is diverging from price (divergence warnings).
The classic squeeze momentum concept — Bollinger Bands contracting inside Keltner Channels — has been available on TradingView for years. What this indicator adds is an entirely different momentum calculation that is ATR-normalized (making it comparable across instruments and timeframes), a 4-state color-coded histogram that distinguishes between momentum acceleration and deceleration in both directions, automated divergence detection with optional HTF trend filtering, and a preset system tuned for different trading styles. The result is a modernized squeeze oscillator designed for practical trading rather than textbook demonstration.
🔍 WHAT MAKES IT ORIGINAL
1. ATR-normalized momentum oscillator. Most squeeze indicators use a raw linear regression value or simple price-minus-midline for their histogram. This makes the oscillator's scale dependent on the instrument's price level — a reading of 5.0 on BTCUSD means something completely different than 5.0 on EURUSD. This indicator solves that by dividing the raw momentum by the current ATR value, producing a dimensionless oscillator that typically ranges between −3 and +3 regardless of instrument or timeframe. The raw momentum itself is calculated as the distance between price and the average of the highest-high/lowest-low midpoint and an EMA — capturing both range-based and trend-based positioning. An optional EMA smoothing layer (configurable, default 3) reduces noise without excessive lag.
2. EMA-based volatility bands instead of standard Bollinger Bands. The squeeze detection uses an EMA (not SMA) as its basis, paired with standard deviation for the band width. EMA reacts faster to recent price changes than SMA, making the squeeze detection more responsive to volatility shifts — particularly useful on crypto and volatile instruments where compression phases can be short-lived. The ATR channel (replacing the traditional Keltner Channel) uses the same EMA basis. The squeeze fires when the volatility band width is less than the ATR channel width (ratio < 1.0).
3. Tiered squeeze intensity. Instead of a binary on/off squeeze state, the indicator classifies the compression into four tiers based on the ratio between the volatility band width and the ATR channel width:
— EXTREME (ratio < 0.5): very tight compression, highest energy buildup
— HIGH (ratio < 0.7): significant compression
— MID (ratio < 0.9): moderate compression
— LOW (ratio < 1.0): mild compression
— NONE (ratio ≥ 1.0): no squeeze
This lets you distinguish between a mild contraction (which may resolve quietly) and an extreme compression (which is more likely to produce a strong directional move).
4. 4-state histogram coloring. The momentum histogram uses four distinct colors to convey both direction and acceleration:
— Bull Strong (bright green): momentum above zero AND rising — bulls are accelerating
— Bull Weak (teal): momentum above zero BUT falling — bulls are decelerating, potential topping
— Bear Strong (bright red): momentum below zero AND falling — bears are accelerating
— Bear Weak (dark red): momentum below zero BUT rising — bears are decelerating, potential bottoming
The transition from Strong to Weak (or vice versa) often precedes a zero-line cross, giving an early visual warning of momentum shifts.
5. Automated divergence detection with two modes. The indicator scans for classic divergences between price pivots and momentum pivots:
— Bullish divergence : price makes a lower low while momentum makes a higher low
— Bearish divergence : price makes a higher high while momentum makes a lower high
Two detection modes are available:
— Early mode (default): divergence is labeled on bar close at the pivot with zero right-side confirmation bars — fastest detection, may occasionally produce false signals
— Confirmed mode : requires N confirmation bars on the right side of the pivot (same as the lookback length) — more reliable, but delayed
Divergence lines are drawn on the oscillator connecting the two momentum pivots, and optional overlay labels are placed directly on the price chart (using force_overlay) so you can spot divergences without switching panes.
6. HTF trend filter for divergences. An optional higher-timeframe filter compares a 21-period EMA to a 50-period EMA on the selected HTF (default 60min). When enabled, bullish divergences are only shown when the HTF trend is bullish (fast EMA > slow EMA), and bearish divergences only when HTF is bearish. The HTF data uses the standard non-repainting pattern ( + lookahead_on). This filter reduces counter-trend signals that divergences often produce.
⚙️ HOW IT WORKS
Squeeze detection:
On each bar, the script calculates two band widths:
— Volatility band width = StdDev(source, length) × multiplier × 2, centered on an EMA
— ATR channel width = ATR(length) × multiplier × 2
The squeeze ratio = volatility width / ATR width. When this ratio falls below 1.0, volatility bands are inside the ATR channel — the market is in a squeeze. The tier is determined by how far below 1.0 the ratio is.
Momentum calculation:
— Midpoint 1: (highest high over N bars + lowest low over N bars) / 2
— Midpoint 2: EMA(source, N)
— Combined midpoint: average of Midpoint 1 and Midpoint 2
— Raw momentum: source − combined midpoint
— Normalized momentum: raw momentum / ATR(N)
— Final momentum: EMA(normalized momentum, smoothing) if smoothing > 1, else raw normalized
This approach blends range-based positioning (where is price within the recent range) with trend-based positioning (where is price relative to the EMA), then normalizes by ATR so the oscillator is instrument-agnostic.
Divergence detection:
The script uses ta.pivotlow() and ta.pivothigh() on both the momentum oscillator and price (low/high). For each new momentum pivot, it compares against the previous stored pivot. A bullish divergence is detected when the current price pivot low is lower than the previous one, but the current momentum pivot low is higher. Bearish divergence is the mirror. In Early mode (rightBars = 0), the pivot is identified at bar close without waiting for right-side confirmation. In Confirmed mode (rightBars = lookback), pivots are only confirmed after N bars pass.
HTF filter:
HTF EMAs are fetched with request.security() using the + lookahead_on non-repainting pattern. When the 21 EMA is above the 50 EMA on the higher timeframe, the HTF trend is bullish; below = bearish.
Squeeze release alert:
The "squeeze fired" alert triggers on the first confirmed bar after the squeeze condition ends (sqzOn transitions from true to false). The alert message includes the momentum direction at release (bullish if momentum > 0, bearish if ≤ 0).
📖 HOW TO USE
Reading the histogram:
— Bright green bars (Bull Strong) = momentum above zero and accelerating — strongest bullish phase
— Teal bars (Bull Weak) = momentum above zero but decelerating — bulls losing steam
— Bright red bars (Bear Strong) = momentum below zero and accelerating — strongest bearish phase
— Dark red bars (Bear Weak) = momentum below zero but decelerating — bears losing steam
— Transition from Strong → Weak = early warning of momentum exhaustion
— Zero-line cross after Weak phase = momentum direction change
Reading the squeeze:
— Orange-tinted background = active squeeze (volatility compression)
— The longer and tighter the squeeze, the more energy is stored
— Watch for the first bar after the background clears (squeeze release) — the momentum direction at that moment often indicates the breakout direction
Reading divergences:
— Green "Div" label below the oscillator / below price = bullish divergence (potential bottom)
— Red "Div" label above the oscillator / above price = bearish divergence (potential top)
— Lines on the oscillator connect the two pivots that form the divergence
— Divergences inside a squeeze are particularly powerful — they suggest the breakout direction before the squeeze releases
Suggested workflow:
— Wait for a squeeze to form (background tint appears)
— Watch for divergences during the squeeze — they hint at breakout direction
— On squeeze release, check momentum direction and histogram color
— Bright green at release = bullish breakout bias; bright red = bearish
— If HTF filter is enabled, only take signals aligned with the higher-timeframe trend
Presets:
— Conservative : length ≥ 25, BB mult ≥ 2.2, ATR mult ≤ 1.2, smoothing ≥ 7 — fewer signals, smoother histogram, suited for 4H–Daily
— Default : uses your manual settings — balanced for 15min crypto
— Aggressive : length ≤ 14, BB mult ≤ 1.6, ATR mult ≥ 1.6, smoothing ≤ 2 — more signals, faster reaction
— Scalping : length ≤ 10, BB mult ≤ 1.4, ATR mult ≥ 1.8, no smoothing — optimized for 1–5min
⚙️ KEY SETTINGS REFERENCE
— Squeeze Length (default 21): shared lookback for EMA, StdDev, and ATR — higher = slower squeeze detection, longer compression phases
— Volatility Band Mult (default 1.8): multiplier for the EMA ± StdDev bands — higher = wider bands, squeeze triggers more easily
— ATR Channel Mult (default 1.6): multiplier for the ATR channel — lower = narrower channel, squeeze triggers less
— Momentum Length (default 20): lookback for highest-high, lowest-low, and momentum EMA
— Momentum Smoothing (default 3): EMA smoothing on the normalized momentum — 1 = raw, higher = smoother
— Divergence Lookback (default 3): pivot detection lookback for divergence scanning
— Early Divergence (default On): label on bar close with no right-side confirmation — faster but less filtered
— Use HTF Trend Filter (default Off): filter divergences by higher-timeframe EMA trend
— Higher Timeframe (default 60): HTF for trend filter — should be 3–5× chart timeframe
🔔 Alerts
Three alert conditions (all bar-close confirmed):
— Squeeze Fire : squeeze releases — includes momentum direction (bullish/bearish)
— Bullish Divergence : price lower low + momentum higher low — includes HTF trend status
— Bearish Divergence : price higher high + momentum lower high — includes HTF trend status
All support standard text and JSON webhook format.
⚠️ IMPORTANT NOTES
— This indicator is a non-overlay oscillator — it appears in a separate pane below the chart. Optional divergence labels can be mirrored on the price chart via the "Show Divergences on Chart" toggle.
— All signals require bar-close confirmation . The HTF filter uses the standard non-repainting security call pattern ( + lookahead_on).
— Early divergence mode (default) labels divergences without waiting for right-side pivot confirmation — this provides faster signals but may occasionally flag a divergence that is later invalidated. Switch to Confirmed mode for higher reliability at the cost of delay.
— A squeeze release indicates that volatility is expanding — it does not guarantee a directional move. False breakouts can and do occur, especially on lower timeframes.
— Divergences signal momentum weakening, not guaranteed reversals. They are most effective as confluence with other analysis, not as standalone signals.
— The ATR normalization makes the oscillator scale-independent, but the absolute readings (e.g. +2.0 vs +1.5) should be compared within the same instrument/timeframe context, not across different ones.
— Works across all asset classes. Volume is not used in any calculation.
Pine Script® indicator






















