Free Volume Anomaly Indicator for TradingView: Entry Setup and Exit Warning in One Script

·
Cover for Free Volume Anomaly Indicator for TradingView: Entry Setup and Exit Warning in One Script

Most volume indicators answer one question: is volume high right now?

That confirms something happened. It won’t tell you whether the move just started, is halfway through, or is running out of fuel.

A free open-source TradingView script built on rolling volume Z-Score math covers both gaps: it flags the setup before a move starts and warns when that move is burning through its last volume.

Volume Flow Anomaly · AnomIQ Preview


The Problem With Standard Volume Indicators

A standard volume bar shows how much was traded in the current candle. “High volume” means different things depending on the asset, the time of day, and the current volatility regime.

A 1-minute candle with $2M traded on BTCUSDT at 3am UTC is exceptional. The same $2M at 9am UTC during a news event is unremarkable. A fixed threshold cannot distinguish the two.

Timing is the second problem. By the time a volume spike is obvious on a bar chart, price has already moved. You are confirming what happened, not acting on what is about to.


What the Script Measures

The script computes three values from price and volume data on each bar:

1. Volume Z-Score

The script measures how many standard deviations the current rolling window of volume sits above its historical mean.

vol_z = (mean_vol_window - historical_mean) / historical_stddev

mean_vol_window is the average volume across the rolling window, not a single bar’s value. The z-score measures how far that window average sits from the historical baseline.

A reading of 0 means window volume is exactly average. A reading of 2.0 means it is two standard deviations above the historical norm, statistically unusual for this asset at this time. The z-score is comparable across assets and times of day because it adapts to the local baseline.

The rolling window covers the last 5 completed bars plus the bar in progress. On a 1-minute chart that is approximately 5 minutes of activity.

2. Trend Cleanliness

High volume alone doesn’t confirm a directional move. Volume spikes during two-sided consolidation near key levels too. Trend cleanliness measures how consistently price action moved in one direction across the rolling window:

cleanliness = |net_price_move| / sum(|individual_bar_moves|)

A value of 100% means every bar moved the same way, a perfect one-directional trend. A value near zero means bars alternated regardless of total distance travelled.

The metric separates directional moves from high-volume noise.

3. Relative Price Impact

Relative Price Impact measures how much price moved per dollar of volume transacted:

relative_price_impact = |price_return_%| / (window_notional_volume / $1M)

window_notional_volume is USD-denominated volume over the window (price × quantity). When a large amount of notional volume moves price very little, a passive order on the other side is absorbing the flow. That absorption is the earliest sign a directional move is loading.


The Three-Phase Trade Lifecycle

Standard indicators fire one signal. This script tracks three: setup, entry, and exit warning.

Phase 1 Setup: The Fuel Is Loading

Signal: Yellow dot

Vol Z crosses the early warning threshold (default 1.3σ) while trend cleanliness is still low. Volume is arriving but price has not committed to a direction yet.

Quant rationale: When vol Z rises without a corresponding rise in trend cleanliness, volume is flowing in but price hasn’t picked a direction. A large participant is building a position (accumulating or distributing) before committing to a move. The gap between rising volume and flat price is the earliest detectable sign of what’s coming.

On fast-moving symbols the yellow dot often appears before the absorption diamond, though the timing depends on how quickly volume builds. Watch. Don’t enter yet.

Phase 2 Entry: Absorption Detected

Signal: Absorption diamond

Vol Z is above the main threshold (default 2.0σ) and price barely moved over the window (less than 0.3% return, low relative price impact).

Teal diamond: the estimated buy side dominated the window, bullish lean. Red diamond: the estimated sell side dominated, bearish lean.

Quant rationale: When volume is anomalously elevated but price barely moves, a passive counterparty is absorbing the aggressive flow. A large resting limit order is working at this price, acting as a temporary anchor.

When that order finishes filling, the anchor lifts. Price breaks through if the counterparty stops absorbing, or reverses toward them if they reveal directional intent.

The directional move usually follows within 2–5 bars.

Phase 3 Exit Warning: The Fuel Is Exhausted

Signal: Teal or red triangle

Vol Z is above the main threshold AND trend cleanliness is above the clean threshold AND price has moved meaningfully in one direction.

Quant rationale: Vol Z is mean-reverting by construction. Once a spike enters the historical lookback it raises the baseline mean, making the same volume level less anomalous with each passing bar. A spike to 2–3σ is typically a one-time event: a large order arriving, a news catalyst, a stop cascade. When that order flow finishes deploying, volume returns to baseline.

The triangle fires at or near the peak of that event. With the spike now normalising, momentum has no new fuel unless another catalyst arrives.

Tighten your stop. Plan your exit. Don’t enter here.


How to Use It

Settings:

  • Chart: 1-minute timeframe
  • Window Length: 5 bars (default), approximately 5 minutes of activity on a 1m chart
  • Historical Lookback: 100 bars (default), the baseline for Z-Score calculation
  • Vol Z Threshold: 2.0σ (default), adjust higher on volatile assets to reduce noise
  • Trend Cleanliness Min: 50% (default), how directional the move must be for a triangle to fire

The sequence to watch for:

Yellow dot → absorption diamond → triangle
Setup      → entry             → exit warning

Two of those three in sequence is worth attention. All three with consistent vol Z elevation across bars is the strongest setup.

What it does not do:

The buy/sell split (which determines whether the diamond is teal or red) uses bar-range geometry to estimate taker side:

buy_fraction = (close - low) / (high - low)

Bar-range geometry is a standard approximation. It works well on trending bars and poorly on doji or reversal bars. It can’t distinguish a large buyer absorbing sell-side flow from a large seller distributing into buy-side flow. Both produce similar bar shapes with opposite intentions.

Real taker classification requires tick-level data: the actual direction of each individual trade matched against the prevailing bid or ask at execution time. AnomIQ’s scanner processes this in real time, which is why the platform’s absorption signals are more reliable than this approximation.


Why Vol Z Is More Useful Than Relative Volume

Relative volume (RVOL) compares today’s volume to the same time of day over past sessions. It tells you whether today is busier than usual at this hour.

Vol Z asks something narrower: is this specific 5-minute window statistically unusual compared to recent activity on this asset?

For short-term trading that distinction matters. RVOL uses daily or hourly aggregates and doesn’t react to intraday regime shifts. Vol Z reacts within minutes. When a large participant enters the market, vol Z catches it at the window level, not the daily level.

Vol Z also adjusts for the current volatility regime. During high-activity periods the historical stddev grows, so a 2σ reading requires more absolute volume to trigger. During quiet periods less volume crosses that threshold. RVOL doesn’t adapt this way.


Get the Script

The script is free and open-source. Every line is visible in the Pine Editor.

Volume Flow Anomaly · AnomIQ Preview on TradingView

For the full platform with tick-level taker classification, real-time scanner across 500+ symbols, and all three timeframes (5m, 15m, 60m), see AnomIQ.