TradingView indicator calculations

Relative volume indicator: choose the denominator first

A relative volume indicator divides observed volume by a historical volume baseline. A value of 1.5 means volume is 50% above that baseline. A rolling average uses preceding bars; same-time relative volume compares corresponding points in earlier periods. The denominator, session, and bar confirmation policy must match before two RVOL readings can be compared.

Build an RVOL calculation

Define the historical sample

TradingView documents its screener Relative Volume as current volume divided by the mean of the preceding 10 bars, excluding the current bar. Its screener Relative Volume at Time instead compares corresponding five-minute bars over 10 prior days. The chart indicator has separate anchor, length, and calculation-mode inputs; do not assume the screener and chart use identical settings.

MeasureNumeratorDenominator
Rolling RVOLCurrent bar volumeMean volume of N preceding bars
Same-time RegularCurrent bar volumeMean matching-bar volume over N historical periods
Same-time CumulativeVolume since the current anchorMean cumulative volume through the matching bar in N historical periods

A reproducible three-period example

These invented volumes are in thousands of shares. Assume standard five-minute bars, a 09:30 session anchor, identical sessions, no missing bars, and a length of three. Each row uses completed bars. The short length makes the arithmetic visible; it is not a recommended setting or a reproduction of the screener default.

  • Same-time single-bar means are (100 + 120 + 80) / 3 = 100, then 60, then 40.
  • Historical cumulative volumes at 09:35 are 160, 200, and 120. Their mean is 160; today has accumulated 270.
  • For the rolling comparison only, assume the last three bars of the preceding session were 50, 40, and 30, in chronological order. These closing bars are separate from the opening-bar slice above. Keep them in the rolling history across the session boundary.
Bar opening timePrior session APrior session BPrior session CToday
09:3010012080150
09:35608040120
09:4040503030

Compute each bar using the same input data

Divide each numerator by its specified baseline. Values below are rounded to four decimals where needed. At 09:40, the same 30,000-share bar produces rolling RVOL of 0.30, same-time Regular RVOL of 0.75, and same-time Cumulative RVOL of 1.50. The disagreement follows from the different questions each denominator answers.

  • Including the current bar changes the rolling definition. At 09:35, an average of 30, 150, and 120 is 100, giving 1.20 instead of 1.6364.
  • A cumulative ratio can stay above one even when the latest bar is below its own same-time average. Earlier volume remains in the cumulative numerator.
Completed barRolling baselineRolling RVOLSame-time RegularSame-time Cumulative
09:30(50 + 40 + 30) / 3 = 40150 / 40 = 3.75150 / 100 = 1.50150 / 100 = 1.50
09:35(40 + 30 + 150) / 3 = 73.3333120 / 73.3333 = 1.6364120 / 60 = 2.00270 / 160 = 1.6875
09:40(30 + 150 + 120) / 3 = 10030 / 100 = 0.3030 / 40 = 0.75300 / 200 = 1.50

Set up Relative Volume at Time on the chart

Add TradingView's Relative Volume at Time indicator. Select the chart interval, Anchor Timeframe, Length, and Calculation Mode explicitly. The indicator matches elapsed time from each anchor. Regular uses individual bars; Cumulative uses volume since the anchor. An anchor at or below the chart interval resets every bar, reducing the comparison to recent bars.

  • For an intraday session comparison, start with a daily anchor and verify where the selected feed begins each daily period. A daily anchor is not a promise of a 09:30 cash-session reset.
  • Write down the selected mode next to any exported or manually recorded number. Keep the mode unchanged while checking the example arithmetic.

An unfinished bar has an unfinished numerator

A live bar has only accumulated volume so far, while historical matching bars are complete. In the example, suppose the 09:35 bar has accumulated 30 rather than its eventual 120. Same-time Regular is then 30 / 60 = 0.50, and Cumulative is (150 + 30) / 160 = 1.125. At the close they become 2.00 and 1.6875. Those are different observation times.

  • Record the value at bar close for a completed-bar comparison. In Pine, barstate.isconfirmed identifies historical bars and the closing update of a real-time chart bar.
  • If you choose an intrabar alert, save its timestamp and live value. A later chart of completed bars cannot reconstruct every intermediate reading.
  • A time-scaled projection would add an assumption about future volume arrival. Label it as an estimate and test it separately from the raw ratio.

Check sessions and missing observations before thresholds

TradingView's screener documentation limits Relative Volume to regular sessions. A custom chart script needs its own explicit session policy. Pine session checks use the exchange timezone unless another timezone is supplied; changing the chart clock does not define that policy. For some futures, the named regular session covers electronic trading rather than only cash-market hours.

CaseCheck or implementation decision
Extended hours enabledDecide whether those bars enter both numerator and history. Compare the same session selection on both charts.
Historical matching bar absentThe built-in chart indicator uses the last available bar before that offset. A custom strict-match policy would produce different results.
Short session or trading haltInspect the historical observations used at the affected time rather than treating the date as a full normal session.
Zero baseline or missing volumeFor a custom script, return unavailable and suppress threshold alerts. Do not display an infinite ratio or replace missing values with zero.
Insufficient historyRequire the requested number of valid samples, or disclose the smaller sample count. This page assumes all three samples exist.

Give Pineify a calculation contract to implement

Ask the Pine Script AI Coding Agent to expose the numerator, denominator, sample count, session, and confirmation status alongside RVOL. Choose rolling or same-time sampling before requesting the script. Use the tables above as a manual calculation fixture, then compare completed bars on your chosen TradingView feed.

  • Example requirement: use prior completed bars for a rolling baseline, preserve the history across session boundaries, and evaluate an alert only when the chart bar closes and the ratio crosses above a user-selected threshold.
  • For same-time sampling, specify the anchor, Regular or Cumulative mode, and whether a missing offset uses the previous available bar or makes the result unavailable.
  • Request syntax validation and inspect the source. Then verify values and timestamps on the chart. Define exits, position sizing, fills, and costs separately before converting an activity condition into a strategy.
Where Pineify fits

Pine Script AI Coding Agent

Draft an RVOL indicator with an explicit baseline, session policy, and confirmation time. Inspect the generated Pine Script and compare its numerator and denominator with your own calculation.

Build an RVOL calculation

Frequently asked questions

Educational calculation examples, not investment advice. All example volumes are hypothetical. RVOL measures activity against a chosen baseline and does not guarantee a price move or trading return.

Sources and verification

Published by Pineify. Pineify is an independent product and is not affiliated with TradingView. Sources support the technical explanations; examples do not establish trading performance.