Skip to content

Relative Vigor Index ​

Relative vigor: close minus open against the range, with a signal.

Kind indicator · Drawn in its own pane

Try it ​

On the chart, press / and choose Relative Vigor Index under Oscillators. To change it, copy the source below into the AlphaScript editor.

Inputs ​

InputTypeDefault
Lengthint10
RVGI colorcolor"#089981"
Signal colorcolor"#F23645"

Source ​

From packages/alphascript/indicators/rvgi.as.js.

js
indicator({ name: "Relative Vigor Index", shortTitle: "RVGI", overlay: false, precision: 4 });
const length = input.int("Length", 10, { min: 1 });
/** @param {Series} s */
const swma = (s) => ta.calc([s], (v) => (s.at(3) + 2 * s.at(2) + 2 * s.at(1) + v) / 6);
const num = swma(ta.calc([candle.close, candle.open], (c, o) => c - o)), den = swma(ta.calc([candle.high, candle.low], (h, l) => h - l));
const rvi = ta.calc([ta.sum(num, length), ta.sum(den, length)], (n, d) => n / d);
plot(rvi, { title: "RVGI", color: input.color("RVGI color", "#089981", { group: "Style" }) });
plot(swma(rvi), { title: "Signal", color: input.color("Signal color", "#F23645", { group: "Style" }) });

AlphaScript language v0.1 · runtime 0.2.0