Range Compression Z-Score Research
Finds unusually tight, sideways multi-day price ranges by ranking each range against its own history, then marks the range and its breakout levels.
Open on TradingView
What it shows
The idea behind this indicator is that volatility moves in cycles: quiet stretches tend to be followed by sharper moves. It looks for those quiet stretches, a few days in which a price traded within an unusually narrow range.
It measures each completed multi-day range (the distance from the highest high to the lowest low over those days) against a long history in two ways: a percentile rank, which says what share of past ranges were tighter, and a z-score, which says how far the range is from its own average, counted in standard deviations.
It also checks that the price really moved sideways rather than trending slowly, and that one wild day did not make up the whole range. When every test passes, it draws the range as a box on the price chart, with an upper and a lower trigger level.
How it is calculated
- Range: the high-to-low distance over a set number of completed daily bars (7 by default), as a percentage of the price.
- Percentile rank: where that range ranks among all completed windows in the historical sample (378 daily bars by default). A percentile of 5% or lower means the range is tighter than 95% of earlier windows.
- Z-score: how many standard deviations the range sits above or below its historical average.
- Tightness rule: percentile only, z-score only, either one, or both. The default is percentile at or below 4, or z-score at or below -1.
- Sideways test: the net move from the first to the last close, divided by the height of the box (at most 0.35 by default), and the slope of a straight line fitted through the closes, called a linear regression (at most 1% over the range by default).
- Uniformity test: the coefficient of variation of the daily ranges, which is their standard deviation divided by their average (at most 0.8 by default), and a cap on how much of the box a single day can make up (0.9 by default).
- Trigger levels: the top and bottom of the box plus an optional buffer, either a fraction of the ATR (average true range, a measure of how much the price typically moves in a day), a percentage of the price, or a number of ticks. The default is 5% of a 21-day ATR.
- Optional volume filter: the volume of the breakout bar compared with its 50-bar simple moving average. It is off by default.
Data used: the prices of the symbol on your chart.
How to read it
- Lower pane: a green line and background mean the range is extremely tight and passes every test (QUALIFIED). Teal means tight, but it failed the drift, slope or uniformity test (TIGHT ONLY). Grey means normal or expanding volatility (WAIT). The orange line is your threshold.
- “Q” circles mark bars where every condition is met.
- Price chart: boxes are drawn around qualifying ranges and shaded by how rare they are: lime for the tightest 2% or less, teal for 5% or less, blue for other qualifying boxes. Each box shows its percentile (p) and z-score (z).
- Orange lines are the upper and lower trigger levels. “BO Up” (green triangle) marks a confirmed close above the upper trigger; “BO Dn” (red triangle) marks a confirmed close below the lower trigger.
- The status table at the top right shows the status and the live numbers: range %, percentile, z-score, drift, slope, range variation and the trigger levels.
- It is built to be used in two steps: the daily research timeframe finds multi-day ranges, and the same indicator on an intraday chart (for example 5 or 15 minutes) shows the trigger levels and the confirmed closes.
Good to know
- Breakout marks need a confirmed bar close beyond a trigger level. A wick, a brief move past the level within a bar, does not count.
- Only completed bars make up the range; the current, unfinished day is not part of it.
- It needs a long history before it shows anything: by default 378 daily bars plus the range and ATR windows.
- Every threshold is a setting. The description on TradingView gives some numbers as examples (such as a 252-day lookback or the 10th percentile), so the defaults in the script can differ from them.
- An update on 22 September 2026 made TradingView’s Pine Screener use your own settings for this script.
How to add it to your chart
- Open the indicator’s page on TradingView and sign in to your TradingView account.
- Select “Use on chart” to open it on a chart, or “Add to favorites” to keep it in your list.
- On any chart, open Indicators and find it under Favorites, or search for its name. Change its settings in the indicator’s Inputs.
This indicator is a research tool. It is not investment advice or a trading signal.
