Skip to content

Relative Strength Index ​

Relative strength index with 70/30 bands.

Kind indicator · Drawn in its own pane

Try it ​

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

Inputs ​

InputTypeDefault
RSI lengthint14
Sourcesource"close"
Upper bandint70
Lower bandint30
Colorcolor"#7E57C2"
Backgroundcolor"rgba(126,87,194,0.1)"

Source ​

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

js
indicator({ name: "Relative Strength Index", shortTitle: "RSI", overlay: false, precision: 2, titleInputs: ["RSI length", "Source"] });
const length = input.int("RSI length", 14, { min: 1 });
const src = input.source("Source", "close");
const upperBand = input.int("Upper band", 70, { group: "Bands" }), lowerBand = input.int("Lower band", 30, { group: "Bands" });
plot(ta.rsi(src, length), { title: "RSI", color: input.color("Color", "#7E57C2", { group: "Style" }) });
hline(upperBand, { title: "Upper band", color: "#787B86", style: "dashed" });
hline(50, { title: "Middle band", color: "rgba(120,123,134,0.5)", style: "dotted" });
hline(lowerBand, { title: "Lower band", color: "#787B86", style: "dashed" });
fill(upperBand, lowerBand, { title: "Background", color: input.color("Background", "rgba(126,87,194,0.1)", { group: "Style" }) });

AlphaScript language v0.1 · runtime 0.2.0