Stochastic RSI
All indicators

LibraryMomentum

Indicator

Stochastic RSI

Where the RSI sits within its own range of the last bars, from 0 at its lowest to 100 at its highest. It turns faster than the RSI itself.

MomentumOwn pane5 inputsStochRSI

How it is calculated

First the catalogue's RSI over the RSI length, with Wilder's smoothing. The raw %K is 100 times the RSI minus its lowest value, divided by its highest minus its lowest, over the stochastic length; %K is an SMA of that over the %K smoothing, %D an SMA of %K. A range under 1e-9 RSI points counts as flat and gives 0. %K is held back until %D has a value. With a %K smoothing of 1 it is TA-Lib STOCHRSI, after Chande and Kroll 1994.

Reference: TA-Lib STOCHRSI (Chande and Kroll 1994), %K smoothed by an SMA

How to read it

Above 80 the RSI is at the top of its recent range, below 20 at the bottom. As a stochastic of an oscillator it reaches the extremes often and stays there in a trend, so it is noisier than RSI; crossings of %K and %D and returns across 20 or 80 matter more than the level. It shows where the RSI stands, not how strong the move is.

In a strategy

Timing inside a trend: in an uptrend, buy a pullback when ctx.ind("stochrsi", rsi_length=14, length=14).k crosses back above 20, compared with its value a bar earlier.

Inputs

InputTypeDefaultRange or choices
RSI lengthrsi_lengthWhole number14min 2, max 5000
Stochastic lengthlengthWhole number14min 1, max 5000
%K smoothingsmooth_kWhole number3min 1, max 5000
%D lengthsmooth_dWhole number3min 1, max 5000
SourcesourcePrice"close"close, open, high, low, hl2, hlc3, ohlc4, hlcc4

What it draws

LineDrawn as
%KLine
%DLine

Moves between 0 and 100. Guide lines at 20, 80.

Used in

No strategy template reads it yet.

OrionQuant