Skip to content

Relative Volatility Index ​

RSI computed on standard deviation instead of price change.

Kind indicator · Drawn in its own pane

Try it ​

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

Inputs ​

InputTypeDefault
Lengthint10
EMA lengthint14
Sourcesource"close"
Colorcolor"#7E57C2"

Source ​

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

js
indicator({ name: "Relative Volatility Index", shortTitle: "RVI", overlay: false, precision: 2 });
const length = input.int("Length", 10, { min: 1 }), emaLength = input.int("EMA length", 14, { min: 1 });
const src = input.source("Source", "close");
const sd = ta.stdev(src, length), ch = ta.change(src, 1);
const upper = ta.ema(ta.calc([ch, sd], (d, s) => (d <= 0 ? 0 : s)), emaLength), lower = ta.ema(ta.calc([ch, sd], (d, s) => (d > 0 ? 0 : s)), emaLength);
plot(ta.calc([upper, lower], (u, l) => (u / (u + l)) * 100), { title: "RVI", color: input.color("Color", "#7E57C2", { group: "Style" }) });
hline(80, { title: "Upper band", color: "#787B86", style: "dashed" });
hline(50, { title: "Middle band", color: "rgba(120,123,134,0.5)", style: "dotted" });
hline(20, { title: "Lower band", color: "#787B86", style: "dashed" });
fill(80, 20, { title: "Background", color: "rgba(126,87,194,0.1)" });

AlphaScript language v0.1 · runtime 0.2.0