OPEN-SOURCE SCRIPT

Volatility Squeeze Oscillator [JOAT]

643
Volatility Squeeze Oscillator [JOAT]

Introduction

Volatility does not move randomly. It compresses, coils, and then releases — and the magnitude of the release is frequently proportional to the depth and duration of the compression. This relationship between volatility contraction and subsequent expansion is one of the most durable patterns in market behavior across all asset classes and timeframes. The Volatility Squeeze Oscillator [JOAT] is built to quantify this relationship with precision, using a multi-layered analysis framework that goes well beyond standard squeeze detection.

At its core, the indicator uses an ATR compression ratio engine to measure the difference between a short-term and long-term ATR. When the short-term ATR is smaller than the long-term ATR, volatility is contracting — the market is coiling. When the short-term ATR expands beyond the long-term reference, the coil is releasing. This compression differential is normalized against the high-low range, making the oscillator comparable across different instruments and volatility regimes.

Three additional analytical layers are stacked on top of the compression engine. A cumulative delta proxy estimates buying versus selling pressure within each bar using range-based calculations — no Level 2 or order flow data required. A volume RSI module measures whether the current volume is elevated relative to its own history, providing a confluence filter that separates high-conviction from low-conviction squeeze releases. And a statistical deviation band system built on a 200-bar lookback marks the historically significant boundaries of the squeeze oscillator's own distribution, so traders can identify not just whether a squeeze is forming, but how extreme it is relative to its own history.

快照

Core Concepts

1. ATR Compression Ratio Engine

The compression ratio is derived from two ATR calculations at different smoothing periods. Both use EMA smoothing rather than RMA (Wilder's method) to produce a more responsive and visually cleaner oscillator. The short-term ATR reflects current volatility conditions. The long-term ATR (calculated at double the base period) establishes the reference level representing the recent historical norm. The difference between these two — long minus short — is the squeeze value: positive when the market is contracting (short ATR below long-term baseline), negative when expanding.

Pine Script®
trueRange = ta.tr(true) atrShort = ta.ema(trueRange, len) atrLong = ta.ema(atrShort, len * 2) sqzRaw = atrLong - atrShort hlRange = ta.highest(high, len) - ta.lowest(low, len) sqzVal = hlRange > 0 ? sqzRaw / hlRange : 0


Normalizing by the HL range makes the oscillator dimensionless — a squeeze value of 0.3 carries the same meaning whether you are analyzing a $1 stock or a $50,000 Bitcoin contract. The signal line is an EMA of the squeeze value, used to detect the inflection point where the squeeze begins to build (sqzVal crossing above sqzSig) or release (sqzVal crossing below sqzSig).

2. Hyper-Squeeze Detection

A hyper-squeeze occurs when the squeeze value is not merely positive (compressing) but is actively rising for N consecutive bars — indicating an accelerating contraction rather than a stable one. Accelerating compression is particularly significant because it suggests market participants are increasingly reducing their activity, creating a coiled spring effect where the eventual release may be more forceful.

Pine Script®
hyperSqz = sqzVal > 0 and ta.rising(sqzVal, hyperLen)


When a hyper-squeeze is active, a violet tint is overlaid on the oscillator background in addition to the regular delta-driven background color. The dashboard updates the hyper squeeze row to ACTIVE status. This dual visual layer makes extended compression phases immediately distinguishable from ordinary positive squeeze readings.

3. Cumulative Delta Proxy

Order flow analysis — understanding whether buyers or sellers are dominant within a given period — typically requires tick-level data or exchange-provided volume breakdown. This indicator constructs a proxy for cumulative delta using bar-level range analysis, making the information accessible without any data feed requirements.

Pine Script®
barRange = high - low bullPress = barRange > 0 ? (close - low) / barRange : 0.5 bearPress = barRange > 0 ? (high - close) / barRange : 0.5 deltaBar = bullPress - bearPress deltaSma = ta.sma(deltaBar, deltaLen) deltaPos = deltaSma > 0


A close near the high of the bar implies buyers dominated (bull pressure near 1.0). A close near the low implies sellers dominated (bear pressure near 1.0). The difference, smoothed over a configurable window, produces a normalized delta reading. When delta is positive during a squeeze, the compressed volatility is accumulating with a bullish lean. When negative, with a bearish lean. This directional information is used both in the histogram coloring (alpha derived from delta conviction) and in dashboard output.

4. Volume RSI Confluence

Volume RSI applies the standard RSI momentum formula to the volume series rather than price. This produces a normalized [0,100] reading of whether current volume is elevated or depressed relative to its recent distribution. A high volume RSI (default threshold: 65) during a squeeze release indicates that the expansion is occurring on above-average participation — a meaningful distinction from low-volume releases that can quickly reverse.

Pine Script®
volRsi = ta.rsi(volume, 14) highVol = volRsi > volThresh


The volume RSI value and status are displayed in the dashboard. Alert conditions include a "high-volume release" alert specifically when both a squeeze release signal and elevated volume RSI occur simultaneously, providing a higher-conviction composite signal.

5. Statistical Deviation Bands

Rather than using fixed threshold lines at arbitrary values, the oscillator's own distribution is analyzed statistically using a 200-bar lookback. The mean and one and two standard deviation levels of the squeeze value over this window establish dynamically updating bands. These bands are filled with a gradient and rendered at adaptive transparency based on the current Z-score — as the oscillator approaches the 2σ band, the fill becomes more opaque, visually emphasizing extreme readings.

Pine Script®
sqzMean = ta.sma(sqzVal, statLen) sqzStd = ta.stdev(sqzVal, statLen) band1Up = sqzMean + sqzStd band2Up = sqzMean + 2 * sqzStd band1Dn = sqzMean - sqzStd band2Dn = sqzMean - 2 * sqzStd zScore = sqzStd > 0 ? (sqzVal - sqzMean) / sqzStd : 0


A squeeze reading above the 2σ upper band is historically anomalous compression — significantly above what has been typical over the prior 200 bars. Such readings often precede the most explosive release moves.

6. Histogram Coloring and Background Rendering

The histogram bar colors encode two simultaneous dimensions. The base color is red when the squeeze is building (sqzVal above sqzSig) and teal when releasing (sqzVal below sqzSig). The alpha channel of each bar is modulated by the absolute value of the delta conviction — high delta conviction produces more saturated colors, while low-conviction delta (price closing near the bar midpoint) produces more transparent bars. The background color is a 93% alpha gradient driven entirely by delta: teal for bullish delta, red for bearish delta, with the hyper-squeeze violet tint layered on top when active.

Features

  • ATR Compression Ratio Engine: Measures the difference between short-term and long-term EMA-smoothed ATR, normalized by HL range for cross-instrument comparability.
  • Signal Line: EMA of the squeeze value provides the crossover reference for detecting compression buildup and release initiation.
  • Hyper-Squeeze Detection: Identifies accelerating compression phases where the squeeze is rising for N consecutive bars simultaneously.
  • Cumulative Delta Proxy: Bar-range-based buying and selling pressure estimate, smoothed and normalized, requiring no Level 2 data.
  • Volume RSI Confluence: RSI applied to volume series identifies above-average participation, separating high-conviction releases from low-volume ones.
  • Statistical Deviation Bands: 200-bar mean and sigma levels with gradient fill and adaptive transparency based on Z-score position.
  • Delta-Driven Alpha Histogram: Histogram color and opacity encode both squeeze direction and delta conviction simultaneously.
  • Layered Background Coloring: Delta-based background with hyper-squeeze overlay provides immediate pane-level context without requiring close inspection.
  • Signal Markers: Circle markers at oscillator bottom on squeeze cross and release cross events.
  • Seven-Row Dashboard: Real-time status covering state, hyper squeeze, volume RSI, delta bias, Z-score, and squeeze value.
  • Four Alert Conditions: Squeeze building, release detected, hyper squeeze active, and high-volume release composite signal.


Input Parameters

ATR Settings:
  • Base Length: Period for short-term ATR EMA and HL range lookback (default: 20)


Hyper-Squeeze Settings:
  • Hyper Squeeze Consecutive Bars: Number of consecutive rising bars required for hyper-squeeze (default: 3)


Delta Settings:
  • Delta Smoothing Window: SMA period for the delta bar average (default: 10)


Volume RSI Settings:
  • Volume RSI Period: RSI lookback applied to volume series (default: 14)
  • Volume RSI Threshold: Level above which volume is considered elevated (default: 65)


Statistical Bands Settings:
  • Statistical Lookback: Bar count for mean and standard deviation computation (default: 200)
  • Show Bands: Toggle deviation band fills (default: true)


Display Settings:
  • Show Background: Toggle delta and hyper-squeeze background coloring (default: true)
  • Show Signal Markers: Toggle circle markers at squeeze and release crosses (default: true)
  • Show Dashboard: Toggle the seven-row information table (default: true)


How to Use This Indicator

Step 1: Monitor the Squeeze State

The primary read from this oscillator is the current state displayed in the dashboard: SQUEEZING, RELAXING, or EXPANDING. Squeezing means the compression ratio is positive and rising — the market is actively coiling. Relaxing means the compression is positive but flattening or declining — the coil is beginning to unwind. Expanding means the oscillator has gone negative — volatility is actively expanding beyond the historical baseline. The transition from SQUEEZING to RELAXING is the early warning signal; the transition to EXPANDING is confirmation that the release has begun.

Step 2: Watch for Hyper-Squeeze Conditions

When the dashboard shows HYPER SQUEEZE: ACTIVE and the chart shows the violet tint overlay, the compression is accelerating — each bar the market is coiling tighter. These conditions historically precede more forceful releases. In hyper-squeeze conditions, position sizing on the anticipated breakout can be considered carefully, as the magnitude of the release may be larger than during ordinary squeeze exits.

Step 3: Check Delta Bias for Directional Lean

Before committing to a directional bias, check the delta row in the dashboard. Positive delta (bullish) during a squeeze indicates that even during compression, buyers have been closing bars near the upper portion of their range — a bullish accumulation signature. Negative delta (bearish) suggests the opposite. Delta bias does not guarantee direction, but it provides a useful lean when combined with the squeeze release signal.

Step 4: Require Volume RSI Confluence on Release

Not all squeeze releases produce sustained moves. Low-volume releases frequently reverse within a few bars. The "High-Volume Release" alert fires only when both a release cross and elevated volume RSI (above threshold) occur simultaneously. Waiting for this composite signal before acting on a release — rather than responding to the release cross alone — filters out a meaningful number of false expansion signals in low-participation environments.

快照

Indicator Limitations

  • The ATR compression ratio measures relative volatility contraction but cannot determine the direction of the eventual breakout. This indicator identifies when a release is likely, not which way price will move. Directional analysis must come from structure, trend, or other contextual tools.
  • The delta proxy is a bar-level approximation of order flow. It does not access actual tick data, order book data, or trade-level information. In markets with high-frequency activity, the close-to-high/low ratio can systematically misrepresent actual buying and selling pressure.
  • The statistical deviation bands require 200 bars to be fully seeded. On instruments or timeframes with limited history, or immediately after loading a new chart, the bands may produce unreliable readings until sufficient data is available.
  • Volume RSI confluence is not applicable to instruments where volume data is unreliable, unavailable, or represents synthetic aggregation (some forex pairs, certain CFDs). In these cases, the volume RSI row should be treated as informational only.
  • The hyper-squeeze condition measures consecutive rising bars in the squeeze value. This makes it sensitive to the base period setting — shorter periods produce more variable squeeze values, leading to more frequent interruptions of the consecutive count.
  • This indicator operates entirely on the chart's native timeframe. It does not incorporate multi-timeframe squeeze data — a squeeze on a 15-minute chart may be occurring within the context of a much larger timeframe expansion that this indicator would not reflect.


Originality Statement

The Volatility Squeeze Oscillator is a purpose-built analytical instrument that combines techniques not previously assembled in this specific architecture.

  • The ATR compression ratio engine — using EMA-smoothed ATR at the base period versus double the base period, normalized by the HL range — is an original squeeze quantification method. It differs from the widely used Lazybear TTM Squeeze (which measures Bollinger Band width versus Keltner Channel width) by operating entirely within the ATR framework with range normalization.
  • The hyper-squeeze detection via ta.rising() on the already-positive squeeze value identifies accelerating compression as a distinct state separate from ordinary compression, a categorization not found in standard squeeze implementations.
  • The cumulative delta proxy using bar-range ratios (close minus low divided by range for bull pressure; high minus close divided by range for bear pressure), smoothed and normalized, provides order-flow-inspired information without any data dependency beyond OHLC — an original application of range analysis.
  • The integration of volume RSI as a confluence gate within the squeeze oscillator framework — not as a separate indicator but as an internal filter with dedicated dashboard output and composite alert conditions — is an original design choice.
  • The statistical deviation band system applied to the squeeze oscillator's own values (using a 200-bar SMA and StDev of the squeeze value itself) to create adaptive significance thresholds is an original meta-statistical layer not found in comparable oscillators.


Disclaimer

The Volatility Squeeze Oscillator [JOAT] is provided for educational and informational purposes only. It is a technical analysis tool and does not constitute financial advice. Identifying squeeze conditions does not predict the direction or magnitude of subsequent price moves with any certainty. All trading involves risk of loss. Users are solely responsible for their own trading decisions. Please consider your individual risk tolerance and consult a licensed financial professional before engaging in any trading activity.

-Made with passion by officialjackofalltrades

免责声明

这些信息和出版物并非旨在提供,也不构成TradingView提供或认可的任何形式的财务、投资、交易或其他类型的建议或推荐。请阅读使用条款了解更多信息。