Relative Volume (RVOL) Indicator — Free Pine Script v6 for TradingView
- relative-volume-indicator.pine — the complete Pine Script v6 source
- README-FIRST.md — what it does and how to install it
- FREE-LICENSE.md — the free-edition license terms
About this product
Relative Volume (RVOL) Indicator is a free Pine Script v6 indicator by Script Master Labs. It measures relative volume (RVOL) — each bar's volume against its own recent average. The complete source is printed in full on this page and in the free download — paste it into TradingView's Pine Editor and it runs on TradingView's free plan. No payment, no account, no subscription.
What it computes, in its own terms: it relative volume (RVOL): the current bar's volume divided by the average volume of the most recent bars (20 bars by default, adjustable). RVOL describes participation relative to the symbol's own recent average; it does not identify who traded and does not predict direction.
How to use it
Open TradingView's Pine Editor, create a new blank indicator, paste the source, save, and click Add to chart. Adjust the inputs from the gear icon. The full source is printed on this page below, and the free download carries the same source file with an install README and the free-edition license.
Free edition vs paid edition
The script file is the complete indicator — the same Pine Script v6 source sold in the paid edition (https://dual.scriptmasterlabs.com/product/relative-volume-indicator, $19 one-time). The paid edition adds the full written user guide, the evidence receipt, and the licensing and security reviews. Nothing in the script is held back from the free edition.
More free tools — five free Pine Script v6 indicators and a free x402 pre-payment trust check — are collected on the Free Tools hub. Educational software, not financial advice: it measures and draws a stated rule; it does not predict price and shows no win rate.
The complete Pine Script v6 source — free, on this page
Relative Volume (RVOL) Indicator is a free Pine Script v6 indicator by Script Master Labs. It measures relative volume (RVOL) — each bar's volume against its own recent average. The complete source is printed in full on this page and in the free download — paste it into TradingView's Pine Editor and it runs on TradingView's free plan. No payment, no account, no subscription.
// © 2026 Script Master Labs LLC — Relative Volume Indicator for TradingView
// Research-based, original SML engineering. This indicator MEASURES
// relative volume (RVOL): the current bar's volume divided by the average
// volume of the most recent bars. RVOL describes participation relative to
// the symbol's own recent average. It does not identify who traded, and it
// does not predict direction or any future move.
//@version=6
indicator("SML Relative Volume Indicator", shorttitle = "SML RVOL", overlay = false, precision = 2)
// ── Inputs: Average ─────────────────────────────────────────────────────────
grpAvg = "Average"
avgLen = input.int(20, "Average length (bars)", minval = 2, maxval = 200, group = grpAvg)
avgType = input.string("SMA", "Average type", options = ["SMA", "EMA"], group = grpAvg)
// ── Inputs: Tiers ───────────────────────────────────────────────────────────
grpTier = "Tiers"
tier1 = input.float(1.5, "Tier 1 threshold — Elevated (RVOL ≥)", minval = 0.1, step = 0.1, group = grpTier)
tier2 = input.float(2.5, "Tier 2 threshold — High (RVOL ≥)", minval = 0.2, step = 0.1, group = grpTier)
tier3 = input.float(4.0, "Tier 3 threshold — Extreme (RVOL ≥)", minval = 0.3, step = 0.1, group = grpTier)
colBelow = input.color(color.white, "Below-average column color (white by house rule)", group = grpTier)
colElev = input.color(color.teal, "Elevated column color", group = grpTier)
colHigh = input.color(color.orange, "High column color (gold/amber)", group = grpTier)
colExtreme = input.color(color.red, "Extreme column color", group = grpTier)
// ── Inputs: Reference line ──────────────────────────────────────────────────
grpRef = "Reference Line"
refColor = input.color(color.white, "Reference line (1.0) color", group = grpRef)
refWidth = input.int(1, "Reference line width", minval = 1, maxval = 4, group = grpRef)
// ── Inputs: Spike-breakout markers ──────────────────────────────────────────
grpMark = "Spike-Breakout Markers"
showSpikes = input.bool(true, "Show spike-breakout markers", group = grpMark)
spikeMult = input.float(2.5, "Spike threshold — RVOL ≥", minval = 0.5, step = 0.1, group = grpMark)
breakLen = input.int(20, "Breakout lookback (prior bars)", minval = 2, maxval = 200, group = grpMark)
markerShape = input.string("Arrow", "Marker shape", options = ["Arrow", "Triangle"], group = grpMark)
markerSize = input.string(size.small, "Marker size", options = [size.tiny, size.small], group = grpMark)
labelMode = input.string("Buy/Sell", "Marker label mode", options = ["Buy/Sell", "Call/Put"], group = grpMark)
colMarkUp = input.color(color.teal, "Up-break marker color", group = grpMark)
colMarkDn = input.color(color.red, "Down-break marker color", group = grpMark)
// ── Inputs: Smart table ─────────────────────────────────────────────────────
grpTbl = "Smart Table"
showTable = input.bool(true, "Show smart table", group = grpTbl)
tablePos = input.string(position.top_right, "Table position", options = [position.top_left, position.top_center, position.top_right, position.middle_left, position.middle_center, position.middle_right, position.bottom_left, position.bottom_center, position.bottom_right], group = grpTbl)
tableSize = input.string("small", "Table size", options = ["tiny", "small", "normal"], group = grpTbl)
// ── Relative volume ─────────────────────────────────────────────────────────
// RVOL = volume / average(volume, avgLen). The average is the SMA or the EMA
// of volume over avgLen bars, per the "Average type" input. On symbols or
// feeds that report no volume, volume is na and RVOL is na.
avgVol = avgType == "EMA" ? ta.ema(volume, avgLen) : ta.sma(volume, avgLen)
rvol = na(volume) or na(avgVol) or avgVol == 0 ? na : volume / avgVol
// ── Tiers ───────────────────────────────────────────────────────────────────
// Below average: RVOL < 1.0 (white). Average band: 1.0 ≤ RVOL < tier1 (also
// white — white is the base column color). Elevated: RVOL ≥ tier1 (teal).
// High: RVOL ≥ tier2 (gold/amber). Extreme: RVOL ≥ tier3 (red).
tierLabel = na(rvol) ? "n/a" : rvol >= tier3 ? "Extreme" : rvol >= tier2 ? "High" : rvol >= tier1 ? "Elevated" : rvol < 1.0 ? "Below average" : "Average"
colColor = na(rvol) ? na : rvol >= tier3 ? colExtreme : rvol >= tier2 ? colHigh : rvol >= tier1 ? colElev : colBelow
plot(rvol, "RVOL", style = plot.style_columns, color = colColor)
plot(1.0, "Average reference (1.0)", color = refColor, style = plot.style_line, linewidth = refWidth)
// ── Spike-breakout markers ──────────────────────────────────────────────────
// A spike breakout up requires BOTH, on a confirmed bar: RVOL ≥ spikeMult
// AND the close above the highest high of the prior breakLen bars. The down
// form mirrors it against the lowest low of the prior breakLen bars. The
// prior-bar extremes exclude the current bar (history reference [1]), so the
// current bar can never break its own range. Markers are evaluated on
// confirmed bars only and never move once drawn.
priorHH = ta.highest(high, breakLen)[1]
priorLL = ta.lowest(low, breakLen)[1]
spikeUp = showSpikes and barstate.isconfirmed and not na(rvol) and rvol >= spikeMult and close > priorHH
spikeDn = showSpikes and barstate.isconfirmed and not na(rvol) and rvol >= spikeMult and close < priorLL
upText = labelMode == "Call/Put" ? "CALL" : "BUY"
dnText = labelMode == "Call/Put" ? "PUT" : "SELL"
plotshape(spikeUp and markerShape == "Arrow" ? rvol : na, "Spike breakout up (arrow)", style = shape.arrowup, location = location.absolute, color = colMarkUp, size = markerSize, text = upText, textcolor = color.white)
plotshape(spikeUp and markerShape == "Triangle" ? rvol : na, "Spike breakout up (triangle)", style = shape.triangleup, location = location.absolute, color = colMarkUp, size = markerSize, text = upText, textcolor = color.white)
plotshape(spikeDn and markerShape == "Arrow" ? rvol : na, "Spike breakout down (arrow)", style = shape.arrowdown, location = location.absolute, color = colMarkDn, size = markerSize, text = dnText, textcolor = color.white)
plotshape(spikeDn and markerShape == "Triangle" ? rvol : na, "Spike breakout down (triangle)", style = shape.triangledown, location = location.absolute, color = colMarkDn, size = markerSize, text = dnText, textcolor = color.white)
// ── Smart table ─────────────────────────────────────────────────────────────
// Shows the current RVOL (2 decimals, or n/a), the current volume, the
// average volume, and the current tier label. All text is white, by house
// rule (white over any muted tone). On a symbol with no volume data the RVOL cell
// reads "No volume data".
f_tsize() =>
tableSize == "tiny" ? size.tiny : tableSize == "normal" ? size.normal : size.small
var table tbl = table.new(tablePos, 2, 4, bgcolor = color.new(color.black, 20), border_width = 1, border_color = color.white)
if showTable
ts = f_tsize()
noVol = na(volume)
table.cell(tbl, 0, 0, "RVOL", text_color = color.white, text_size = ts)
table.cell(tbl, 1, 0, noVol ? "No volume data" : na(rvol) ? "n/a" : str.tostring(rvol, "#.##"), text_color = color.white, text_size = ts)
table.cell(tbl, 0, 1, "Volume", text_color = color.white, text_size = ts)
table.cell(tbl, 1, 1, noVol ? "n/a" : str.tostring(volume, "#"), text_color = color.white, text_size = ts)
table.cell(tbl, 0, 2, "Avg volume", text_color = color.white, text_size = ts)
table.cell(tbl, 1, 2, na(avgVol) ? "n/a" : str.tostring(avgVol, "#"), text_color = color.white, text_size = ts)
table.cell(tbl, 0, 3, "Tier", text_color = color.white, text_size = ts)
table.cell(tbl, 1, 3, noVol ? "No volume data" : tierLabel, text_color = color.white, text_size = ts)
// ── Alerts (descriptive only — a measured state, not a signal to trade) ────
alertcondition(ta.crossover(rvol, tier2), title = "RVOL crossed above Tier 2 (High)", message = "RVOL crossed above the Tier 2 threshold on {{exchange}}:{{ticker}} ({{interval}}). RVOL now measures at or above the High tier relative to the recent average volume.")
alertcondition(spikeUp, title = "Spike breakout up", message = "Spike breakout up on {{exchange}}:{{ticker}} ({{interval}}): RVOL at or above the spike threshold and the close above the highest high of the prior lookback bars. A measured volume-and-price event; it is not a direction prediction.")
alertcondition(spikeDn, title = "Spike breakout down", message = "Spike breakout down on {{exchange}}:{{ticker}} ({{interval}}): RVOL at or above the spike threshold and the close below the lowest low of the prior lookback bars. A measured volume-and-price event; it is not a direction prediction.")
Questions about this product
Is there a free Pine Script for relative volume (RVOL) on TradingView?
Yes. Script Master Labs publishes this Relative Volume (RVOL) Indicator as a free Pine Script v6 download on SML Dual Market (https://dual.scriptmasterlabs.com/product/free-relative-volume-indicator). The complete source is printed in full on the product page and in the free download — no payment, no account, no subscription.
How do I use the Relative Volume (RVOL) Indicator?
Open TradingView's Pine Editor, create a new blank indicator, paste the source, click Save, then Add to chart. Adjust the inputs from the gear icon. TradingView's first-steps page shows where the editor opens: https://tradingview.com/pine-script-docs/primer/first-steps
Does it work on TradingView's free plan?
Yes. Paste the source into TradingView's Pine Editor and add it to your chart; the free plan runs custom indicators.
Is the free edition the complete script?
Yes — the same Pine Script v6 source file sold in the paid edition ($19 one-time). The paid edition adds the full written user guide, the evidence receipt, and the licensing and security reviews; nothing in the script itself is held back.
Does it repaint?
No. Its events are computed on confirmed bars only; a marker, once printed, does not move or disappear.