← Script Marketplace
Open-source scriptindicator/v1

Stochastic RSI

by Kodexius·@kodexius·

Apply the stochastic formula to RSI values for a more sensitive bounded momentum oscillator.

#momentum#oscillator#stochastic-rsi
Stochastic RSI chart preview

Description

Stochastic RSI measures the position of RSI within its own recent range rather than the position of price. The additional normalization creates a faster oscillator whose smoothed %K and %D lines are often used to study short-term momentum turns.

Open-source script. Everyone can inspect the source code, use the script on a chart, and save an editable copy.

Release notes

Version history · 1 published version

Version 1CurrentChart updatedStochastic RSI · Aug 31, 2026
Release notes

Initial classic indicator release.

View current source ↓
Source codempl-2.0View source

indicator("Stochastic RSI", { overlay: false });
const rsiLength = input.int("RSI Length", 14, { min: 2, max: 200 });
const stochLength = input.int("Stochastic Length", 14, { min: 2, max: 200 });
const smoothK = input.int("%K Smoothing", 3, { min: 1, max: 50 });
const smoothD = input.int("%D Smoothing", 3, { min: 1, max: 50 });
const r = rsi(close, rsiLength);
const lo = lowest(r, stochLength);
const hi = highest(r, stochLength);
const raw = r.map((v, i) => hi[i] === lo[i] ? 50 : 100 * (v - lo[i]) / (hi[i] - lo[i]));
const k = sma(raw, smoothK);
const d = sma(k, smoothD);
plot(k, { title: "%K", color: "#2962ff", lineWidth: 2 });
plot(d, { title: "%D", color: "#ff6d00", lineWidth: 2 });
hline(80, { title: "Upper", color: "#ef5350", style: "dashed" });
hline(20, { title: "Lower", color: "#26a69a", style: "dashed" });
  

Community discussion

0 comments

Loading…

No comments yet. Start the discussion.