Relative Vigor Index RVI
Close minus open against high minus low, both triangularly smoothed over N bars, with a signal line that is a further weighted average.
It measures whether closes are finishing strong inside their own bars, which is a statement about conviction within a bar rather than about the size of the move. Readings: the level against zero, and the main line crossing its signal.
01The study, live
Computed by Bentrix’s own code over the same synthetic bars on every page — an illustration of how the study behaves, not a market.
What this figure shows
The figure is computed over 300 sample bars. RVI has no value on the first 12 — the bars it needs before it can answer — and its first value stands on bar 13. Its line runs between -0.4892 and 0.4453 on these bars, and the last value is 0.0983. Counting the conditions the study declares on these bars: crosses above 0 6 times; crosses below 0 6 times; crosses above its signal line 28 times; crosses below its signal line 29 times. Press a condition under the figure to see each place marked. As states rather than moments: is above 0 on 144 bars; is below 0 on 144 bars; is above its signal line on 148 bars; is below its signal line on 137 bars.
02Its parts, named
03What you see
Two lines around zero: the RVI and its signal. It compares the close's distance from the open with the bar's range.
04Where it comes from
John Ehlers published the Relative Vigor Index in 2002. The idea is that in a rising market bars tend to close above their open, and in a falling one below; the index measures that tendency against the bars' full range.
05The formula
RVI = (SMA(C − O, N))/(SMA(H − L, N))
with a symmetric four-bar weighting inside each sum, and a signal line from the same weighting of the RVI.
06A worked example
The sample bars used here are eight: closes 20, 21, 23, 22, 24, 25, 24, 26; highs 21, 22, 24, 24, 25, 26, 26, 27; lows 18, 19, 20, 21, 21, 23, 23, 23; opens 19, 20, 21, 23, 22, 24, 25, 24.
Each bar's body is close − open: +1, +1, +2, -1, +2, +1, -1, +2. Each bar's range is high − low: 3, 3, 4, 3, 4, 3, 3, 4.
Both are first smoothed over four bars with weights 1, 2, 2, 1 (newest first). On the last bar the weighted body is 2 + 2 × (-1) + 2 × 1 + 2 = 4, and the weighted range 4 + 2 × 3 + 2 × 3 + 4 = 20. On the bar before they are 4 and 20.
With a period of 2 the index is the sum of the last two weighted bodies over the sum of the last two weighted ranges:
RVI = (4 + 4) / (20 + 20) = 0.20
The signal line is the same 1, 2, 2, 1 smoothing applied to the RVI itself.
07Built in Assay
The same study written in Assay, Bentrix’s script language, and drawn by Bentrix itself as the script’s graph: each block is one step of the formula. On the ladder the steps stand in the script’s order, one a row; on the board each wire carries a value from the block that gives it to the block that reads it, left to right. The script computes exactly what the study computes — Bentrix checks the two against each other, candle by candle.
//@version=6 indicator("Relative Vigor Index") length = input.int(10, "Length") // The candle body and the candle range, each smoothed over four bars with the weights 1, 2, 2, 1. body = (close - open) + 2 * (close[1] - open[1]) + 2 * (close[2] - open[2]) + (close[3] - open[3]) range = (high - low) + 2 * (high[1] - low[1]) + 2 * (high[2] - low[2]) + (high[3] - low[3]) bodies = math.sum(body, length) ranges = math.sum(range, length) // How much of the range the bodies cover: positive when bars close above their opens. rvi = na(ranges) ? na : ranges != 0 ? bodies / ranges : bodies // The signal is the same 1, 2, 2, 1 smoothing of the RVI itself. signal = (rvi + 2 * rvi[1] + 2 * rvi[2] + rvi[3]) / 6 plot(rvi, "RVI") plot(signal, "Signal") hline(0)
Paste it into the Assay IDE to put it on a chart, or to change it. Looking at the graph is free in every package; editing it as blocks is Plus.
08Readings — what traders look for
The RVI above its signal is read as closes ending further above their opens than recently; crossings and divergences are read as with other oscillators.
How RVI crossing its signal fails. The signal is only a four-bar smoothing of the line, so the two cross often and close together; in a market without direction most crossings lead nowhere.
How the sign fails. A positive value says bars have been closing above their opens. On markets that gap — where the open is far from the previous close — a bar can close below its open and still be higher than yesterday, and the index then points against the price.
09In different markets and timeframes
The Relative Vigor Index needs bars with meaningful opens — session-based markets, daily bars. On continuous markets, where each open is the previous close, it reduces to a smoothed momentum. It is at home in markets that swing.
10With other studies
Read with its own signal line, and beside the Intraday Momentum Index and Qstick, which also measure the body of the bars.
11What it does not tell you
It describes where bars close relative to where they open; on markets with little gap between bars, open and previous close are nearly the same.
12Inputs and defaults
- 1Period — 10How many bars of smoothed bodies and ranges are summed. Longer: a smoother line with smaller swings.
- 2Timeframe — ChartThe chart's own by default; any higher one, read on the last closed candle. A finer one is never offered.
- 3Wait for the candle to close — OnThe value of a higher timeframe is taken only from a candle that has finished.
The settings in use
- In use10 by default; Ehlers tuned it to about half the cycle length.
13Limits and common misreadings
It ignores gaps. Only the open-to-close move inside each bar is measured.
No fixed levels. It usually stays within about ±0.5 and has no agreed extreme.
Needs real opens. On data where the open always equals the previous close, it reduces to a smoothed close-to-close change.
14Conditions an alert or a strategy can watch
an event happens on one bar a state holds on every bar while it lasts
These are the conditions the study itself declares — the same rules the alert editor and the strategy engine read, and the ones the figure's chips show.
15Practise it in the laboratory
Put RVI 10 on a chart with gaps (daily bars of a stock index) and find a bar where price rose from the previous day while the RVI fell; read the open and the close of that bar.
Open the laboratory17In Bentrix
- From the menu: a chart's Indicators button › Oscillators › RVI, or type RVI in its search.
- Its settings: the settings card opens when it is added; its legend's name opens it again.
18From an agent or a program
Two tools reach it. study_values computes it over a workbench’s candles up to the clock — no chart needed — and study_attach puts it on a chart, where it is drawn and saved with the chart ({"chart": "<chart uri>", "kind": "rvi"}).
The study, as a chart files it
This is a new RVI’s entry — its kind, its calculation, the price it reads and its settings. Change a setting here to read it with other inputs.
{
"applied": "close",
"convention": "mt5",
"kind": "rvi",
"settings": {
"period": 10,
"shape": "period"
}
}An agent
An agent calls the MCP tool with it:
{
"name": "study_values",
"arguments": {
"bench": "bentrix://lab/\u2026/bench/\u2026",
"symbol": "EURUSD",
"timeframe": "H1",
"limit": 5,
"study": {
"applied": "close",
"convention": "mt5",
"kind": "rvi",
"settings": {
"period": 10,
"shape": "period"
}
}
}
}A program
A program does the same in its language — bench and market as in the built-in indicators guide:
Python
values = client.study.values(bench, market, "H1", {"applied": "close", "convention": "mt5", "kind": "rvi", "settings": {"period": 10, "shape": "period"}}, limit=5)
print("times:", values["times"])
for line in values["lines"]:
print("line:", line["line"])
print(" newest values:", line["values"])JavaScript
const values = await client.study.values({ bench, symbol: market, timeframe: "H1", study: { "applied": "close", "convention": "mt5", "kind": "rvi", "settings": { "period": 10, "shape": "period" } }, limit: 5 });
console.log("times:", values.times);
for (const line of values.lines) {
console.log("line:", line.line);
console.log(" newest values:", line.values);
}C#
var values = await client.Study.Values(bench, market, "H1", new Dictionary<string, object?> { ["applied"] = "close", ["convention"] = "mt5", ["kind"] = "rvi", ["settings"] = new Dictionary<string, object?> { ["period"] = 10, ["shape"] = "period" } }, limit: 5);
Console.WriteLine($"times: {values!["times"]!}");
foreach (var line in values!["lines"]!.AsArray())
{
Console.WriteLine($"line: {line!["line"]!}");
Console.WriteLine($" newest values: {line!["values"]!}");
}Go
values := must(client.Study.Values(ctx, mcp.StudyValuesArgs{Bench: bench, Symbol: market, Timeframe: "H1", Study: map[string]any{"applied": "close", "convention": "mt5", "kind": "rvi", "settings": map[string]any{"period": 10, "shape": "period"}}, Limit: mcp.Ptr[int64](5)}))
fmt.Println("times:", at(values, "times"))
for _, line := range at(values, "lines").([]any) {
fmt.Println("line:", at(line, "line"))
fmt.Println(" newest values:", at(line, "values"))
}Java
Object values = client.study.values(new Bentrix.StudyApi.ValuesArgs(bench, market, "H1", obj("applied", "close", "convention", "mt5", "kind", "rvi", "settings", obj("period", 10, "shape", "period"))).limit(5L));
System.out.println("times:" + " " + at(values, "times"));
for (Object line : (List<Object>) at(values, "lines")) {
System.out.println("line:" + " " + at(line, "line"));
System.out.println(" newest values:" + " " + at(line, "values"));
}C++
auto values = client.study.values_(StudyApi::ValuesArgs(bench, market, "H1", Json::Object{{"applied", "close"}, {"convention", "mt5"}, {"kind", "rvi"}, {"settings", Json::Object{{"period", 10}, {"shape", "period"}}}}).limit(5));
std::cout << "times:" << " " << values["times"].dump() << std::endl;
for (const Json &line : values["lines"].arr()) {
std::cout << "line:" << " " << line["line"].dump() << std::endl;
std::cout << " newest values:" << " " << line["values"].dump() << std::endl;
}Julia
values = client.study.values(bench, market, "H1", Dict{String,Any}("applied" => "close", "convention" => "mt5", "kind" => "rvi", "settings" => Dict{String,Any}("period" => 10, "shape" => "period")); limit = 5)
println("times:", " ", values["times"])
for line in values["lines"]
println("line:", " ", line["line"])
println(" newest values:", " ", line["values"])
endR
values <- client$study$values(bench, market, "H1", list(applied = "close", convention = "mt5", kind = "rvi", settings = list(period = 10, shape = "period")), limit = 5)
cat("times:", format(values$times), "\n")
for (line in values$lines) {
cat("line:", format(line$line), "\n")
cat(" newest values:", format(line$values), "\n")
}Rust
let values = client.study().values(mcp::StudyValuesArgs::new(bench.clone(), market.clone(), "H1", serde_json::json!({"applied": "close", "convention": "mt5", "kind": "rvi", "settings": {"period": 10, "shape": "period"}})).limit(5))?;
println!("times: {}", values["times"]);
for line in values["lines"].as_array().into_iter().flatten() {
println!("line: {}", line["line"]);
println!(" newest values: {}", line["values"]);
}Reading the answer
times— the candles’ open times, in milliseconds since 1970 (UTC), oldest first.lines— one entry per line, in this order, each with itslinename and itsvalues;values[i]belongs to the candle attimes[i].- The last value is the candle at the clock’s, which may still be forming: it changes until that candle closes, as on the chart. Nothing after the clock is ever computed.
nullis a candle with no value yet — the warm-up, about 1 × the period at the start of the history.- Its fixed levels, drawn on the chart:
[0.0].
line | What it is |
|---|---|
Main | the indicator's own value |
Signal | a smoothing of the main line, drawn beside it |
In a strategy
Filed under a key of your choice in a strategy document’s studies — here rvi: {"rvi": {"applied": "close", "convention": "mt5", "kind": "rvi", "settings": {"period": 10, "shape": "period"}}} — its rules can name:
| Write | What it is |
|---|---|
rvi | its main line, as a value in a compare |
rvi.signal | this line, as a value in a compare |
{"cond": "rvi:level.cross_up:0"} | a condition it declares itself |
{"cond": "rvi:level.cross_down:0"} | a condition it declares itself |
{"cond": "rvi:level.above:0"} | a condition it declares itself |
{"cond": "rvi:level.below:0"} | a condition it declares itself |
{"cond": "rvi:signal.cross_up"} | a condition it declares itself |
{"cond": "rvi:signal.cross_down"} | a condition it declares itself |
{"cond": "rvi:signal.above"} | a condition it declares itself |
{"cond": "rvi:signal.below"} | a condition it declares itself |
19Sources
- Ehlers, John F. "Relative Vigor Index." Technical Analysis of Stocks & Commodities, January 2002.
Bentrix 0.1.382Every number, name and default on these pages is read from the application itself.What is comingWhat changed