Relative Volume (RVOL)
Summary
Relative Volume: today's volume as a ratio to the average volume of the bars that came before it. A value of 1 means the bar traded exactly its recent average, above 1 means unusual participation, below 1 means the move is thin. Because the current bar is excluded from its own baseline, a volume spike shows up at full size instead of being diluted by the average it is compared against.
Read it as a confirmation filter rather than a direction signal: it says how much conviction is behind a price move, not which way. Breakouts on a high ratio are the ones that tend to follow through; the same breakout near 1 is the one to distrust.
Chart
Chart metadata i
Outputs
outReal:line·zero·positive
Formula
RVOL_t = Volume_t / ( (1/N) * sum_{i=t-N}^{t-1} Volume_i ), N = optInTimePeriod
Notes
- The baseline is the mean of the N bars preceding the current one, so RVOL needs one bar more than a moving average of the same period before it emits a value.
- A window in which every bar traded nothing has a baseline of zero and no defined ratio: that element is ±Inf, or NaN when the current bar is also zero. Real volume is non-negative, so this only happens on a dead window — an instrument that did not trade at all, or a series carrying no volume, such as a cash-index feed.
Inputs
inVolume— Volume of each bar
Outputs
outReal— Ratio of the current bar's volume to the average of the preceding window
Parameters
| Parameter | Type | Default | Accepted values | Description |
|---|---|---|---|---|
optInTimePeriod | integer | 20 | 1–100000 | Number of preceding bars averaged to form the baseline |
Properties
Numerical Stability: Start-Independent
| ☐ Overlap Input |
| ✅ Independent Y-Axis i |
| ☐ Candlestick |
| ☐ Display Shift |
| ✅ Can Output NaN or ±Inf i |
| ☐ Identity at Period 1 |
| ☐ Uses Transcendental |
| ☐ Input Must Be Positive |
Example
#include <stdio.h>
#include <ta_libc.h>
int n = 252;
double volume[252]; /* your data, oldest first */
double out[252];
int outBegIdx, outNBElement;
TA_Initialize();
TA_RVOL( 0, n - 1, volume, 20, &outBegIdx, &outNBElement, out );
printf( "%d values from bar %d: [%.4f, ..., %.4f]\n", outNBElement, outBegIdx, out[0], out[outNBElement - 1] );use ta_lib::Core;
let volume = vec![0.0; 252]; // your data, oldest first
let mut out = vec![0.0; 252];
let core = Core::new();
let range = core.rvol(0, volume.len() - 1, &volume, 20, &mut out)?;
println!("{} values from bar {}: [{:.4}, ..., {:.4}]", range.count, range.beg_idx, out[0], out[range.count - 1]);import io.github.talib.Core;
import io.github.talib.OutRange;
import java.util.Locale;
double[] volume = new double[252]; // your data, oldest first
double[] out = new double[252];
Core core = Core.DEFAULT;
OutRange r = core.rvol(0, volume.length - 1, volume, 20, out);
System.out.printf(Locale.ROOT, "%d values from bar %d: [%.4f, ..., %.4f]%n", r.count(), r.begIdx(), out[0], out[r.count() - 1]);using System;
using TALib;
var volume = new double[252]; // your data, oldest first
var outReal = new double[252];
var core = Core.Default;
OutRange r = core.Rvol(0, volume.Length - 1, volume, 20, outReal);
Console.WriteLine(FormattableString.Invariant($"{r.Count} values from bar {r.BegIdx}: [{outReal[0]:F4}, ..., {outReal[r.Count - 1]:F4}]"));import { rvol } from 'ta-lib';
const volume = new Float64Array(252); // your data, oldest first
const { begIdx, values } = rvol({ volume }, { timePeriod: 20 });
console.log(values.length + ' values from bar ' + begIdx + ': [' + values[0].toFixed(4) + ', ..., ' + values[values.length - 1].toFixed(4) + ']');import (
"fmt"
"log"
talib "ta-lib.github.io/go"
)
volume := make([]float64, 252) // your data, oldest first
out := make([]float64, 252)
core := talib.NewCore()
r, err := core.RVOL(0, len(volume)-1, volume, 20, out)
if err != nil {
log.Fatal(err)
}
fmt.Printf("%d values from bar %d: [%.4f, ..., %.4f]\n", r.NBElement, r.BegIdx, out[0], out[r.NBElement-1])Implementation
Added in 0.8.1 (ta-lib-python 0.8.1).
TA-Lib Definition: rvol.c · rvol.yaml
| Native | File |
|---|---|
| C | ta_RVOL.c |
| Rust | rvol.rs |
| Java | Core_RVOL.java |
| C# | Core_RVOL.cs |
| TypeScript | rvol.ts |
| Go | rvol.go |
Python: talib.RVOL (ta-lib-python 0.8.1 or later), see ta-lib-python.
TA-Lib is also available for R and more using a wrapper.
Aliases
Relative Volume, RVol
See Also
References
- RVOL has no attributable originator; it is retail scanner convention, and every published definition agrees on the ratio and on excluding the current bar from its own baseline.
- Reference implementation used as the independent oracle: trading-signals,
volume/RVOL.