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.
| Measure | Numerator | Denominator |
|---|
| Rolling RVOL | Current bar volume | Mean volume of N preceding bars |
| Same-time Regular | Current bar volume | Mean matching-bar volume over N historical periods |
| Same-time Cumulative | Volume since the current anchor | Mean 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 time | Prior session A | Prior session B | Prior session C | Today |
|---|
| 09:30 | 100 | 120 | 80 | 150 |
| 09:35 | 60 | 80 | 40 | 120 |
| 09:40 | 40 | 50 | 30 | 30 |
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 bar | Rolling baseline | Rolling RVOL | Same-time Regular | Same-time Cumulative |
|---|
| 09:30 | (50 + 40 + 30) / 3 = 40 | 150 / 40 = 3.75 | 150 / 100 = 1.50 | 150 / 100 = 1.50 |
| 09:35 | (40 + 30 + 150) / 3 = 73.3333 | 120 / 73.3333 = 1.6364 | 120 / 60 = 2.00 | 270 / 160 = 1.6875 |
| 09:40 | (30 + 150 + 120) / 3 = 100 | 30 / 100 = 0.30 | 30 / 40 = 0.75 | 300 / 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.
| Case | Check or implementation decision |
|---|
| Extended hours enabled | Decide whether those bars enter both numerator and history. Compare the same session selection on both charts. |
| Historical matching bar absent | The 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 halt | Inspect the historical observations used at the affected time rather than treating the date as a full normal session. |
| Zero baseline or missing volume | For a custom script, return unavailable and suppress threshold alerts. Do not display an infinite ratio or replace missing values with zero. |
| Insufficient history | Require 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.