Indicator · Pine Script v5 · Own pane

Stochastic and RSI

by teshmi9z-beep

A separate-pane indicator that shows a slow stochastic oscillator and an RSI together.

View on GitHub

GitHub stars1on the repository
Pine versionv5runs as is
Lines of code46
Settings18inputs
LicenceMIT
Last update2 days ago28 Oct 2026

Add It to Your TradingView Chart

  1. 1Copy the scriptPress Copy script above, or the copy button on the code below.
  2. 2Open the Pine EditorOpen a TradingView chart and choose Pine Editor at the bottom of the screen.
  3. 3Paste over the templateCreate a new indicator, select all of the template text and paste. Press Save and give it a name.
  4. 4Add it to the chartPress Add to chart, then adjust the settings with the gear icon next to its name.

Source Code

46 lines of Pine Script v5 from src/indicators/custom/stoRsi.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

stoRsi.pine
//@version=5
indicator("Sto+RSI", overlay=false)


// Paramètres de l'indicateur
voir_sto=input.bool(true,title="Stochastic",group="STO",inline="st")
length_K = input.int(200, title="K Length",group="STO",inline="st1")
colorK= input(color.blue, title="",group="STO",inline="st1")
k_width = input.int(1, title="Ep", minval=1,group="STO",inline="st1")
length_D = input.int(200, title="D Smoothing",group="STO",inline="st2")
//colorD= input(color.orange, title="",group="STO",inline="st2")

d_width = input.int(1, title="Ep", minval=1,group="STO",inline="st2")
smooth_K = input.int(3, title="Smooth K",group="STO",inline="st3")
voirline=input.bool(true,title="Level",group="STO",inline="st4")
upper_level = input.float(80, title="Up",group="STO",inline="st4" ,minval=50, maxval=100)
lower_level = input.float(20, title="Low",group="STO",inline="st4" ,minval=0, maxval=50)
voir_bg = input.bool(true,title="Background",group="STO",inline="st5")

// Calcul du Stochastique
k = ta.sma(ta.stoch(close, high, low, length_K), smooth_K)
d = ta.sma(k, length_D)
d_direction = d > d[1] ? 1 : d < d[1] ? -1 : 0
d_color =  d_direction > 0 ? color.lime : color.red


// Tracer les lignes K et D
plot(voir_sto?k:na, title="K", color=colorK,linewidth=k_width)
plot(voir_sto?d:na, title="D", color=d_color,linewidth=d_width)

// Tracer les niveaux de surachat et de survente
hline(voirline?upper_level:na, "Overbought", color=color.red, linestyle=hline.style_dashed)
hline(voirline?lower_level:na, "Oversold", color=color.green, linestyle=hline.style_dashed)

// Paramètres de l'indicateur RSI
voirrsi= input.bool(true, title="RSI",group="RSI",inline="0")
colorrsi= input(color.black, title="",group="RSI",inline="1")
rsi_length = input.int(14,title="Period", minval=1,group="RSI",inline="1")
rsi_width = input.int(1, title="Ep", minval=1,group="RSI",inline="1")
voirlinersi=input.bool(true,title="Level",group="RSI",inline="2")
upper_level_rsi = input.float(70, title="", group="RSI",inline="2",minval=50, maxval=100)
lower_level_rsi = input.float(30, title="",group="RSI",inline="2", minval=0, maxval=50)
rsi = ta.rsi(close, rsi_length)
plot(voirrsi? rsi :na, title="RSI", color=colorrsi,linewidth=rsi_width)
hline(voirlinersi?upper_level_rsi:na , "RSI Overbought", color=color.black, linestyle=hline.style_dashed)
hline(voirlinersi?lower_level_rsi:na, "RSI Oversold", color=color.black, linestyle=hline.style_dashed)

Overview

The stochastic uses a long K length with smoothing, and its D line changes colour with its direction. Overbought and oversold lines are drawn for both oscillators, with default stochastic levels of 80 and 20 and RSI levels of 70 and 30. Each part can be hidden, and line colours, widths and levels are adjustable. It issues no trade signals of its own.

Details

Published by

teshmi9z-beep on GitHub

Draws

Separate pane below the chart

Markets

Any symbol

Timeframes

Any timeframe

Risk Notes

No repainting, lookahead or stacked entries were found in its code or README. That says nothing about how well it works: test it first.

Settings

The inputs you can change from the gear icon on the chart. Defaults are the author's.

SettingTypeDefaultVariable
Stochasticbooltruevoir_sto
K Lengthint200length_K
colorKcolorcolor.bluecolorK
Epint1k_width
D Smoothingint200length_D
Epint1d_width
Smooth Kint3smooth_K
Levelbooltruevoirline
Upfloat80upper_level
Lowfloat20lower_level
Backgroundbooltruevoir_bg
RSIbooltruevoirrsi
Show all 18 settings
SettingTypeDefaultVariable
colorrsicolorcolor.blackcolorrsi
Periodint14rsi_length
Epint1rsi_width
Levelbooltruevoirlinersi
upper_level_rsifloat70upper_level_rsi
lower_level_rsifloat30lower_level_rsi
Third-party code. ForexR did not write, test or endorse this script, and the summary above was generated automatically from its code and README. Indicators describe the past, and a strategy's backtest can look better than live trading, especially when a script repaints. Check it in the Strategy Tester and on a demo account before you rely on it.

Similar Pine Scripts

Asymmetrical RSI

by everget
947 stars

Asymmetrical RSI is an indicator that computes a custom relative strength index from the rate of change of a user-selected source. It plots the resulting ARSI line in a separate pane with color coding that turns green above the overbought level and red below t

Indicator v4 Oscillators & momentum
Updated 12 days ago · GPL-3.0 GitHub repository of Asymmetrical RSI

This indicator calculates momentum setups based on the Relative Strength Index (RSI) and plots in a separate pane. It offers multiple scanning modes such as Continuous Break, Continuous Retracement, Flip Break, Flip Retracement, and both regular and hidden div

Indicator v6 Oscillators & momentumDivergence Repaints
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - RSI Directional Momentum Indicator

Beep Boop

by magic8bot
409 stars

This indicator calculates a modified MACD oscillator and signal line alongside a trend EMA filter, plotting the output as a stylized column histogram in a separate pane. Instead of plotting true MACD distance, it quantifies positive and negative histogram mome

Indicator v4 Oscillators & momentumTrend
Updated 3 years ago · MIT GitHub repository of Beep Boop
261 stars

This indicator demonstrates an experimental graph-style scatter visualization within a separate pane using Pine Script arrays. It tracks two features across recent bars: the single-bar price change and a scaled 14-period Relative Strength Index. Values are loa

Indicator v4 Oscillators & momentum
Updated 4 years ago · None stated GitHub repository of Example: Graph Style - 4th Dimension RSI
228 stars

This indicator detects a Bollinger Band squeeze when the bands sit inside Keltner Channels, marking low volatility. It plots red dots during a squeeze and green dots when the bands are outside, in a separate pane. An optional histogram shows momentum as the cl

Indicator v6 Volatility & bandsOscillators & momentum
Updated 3 months ago · None stated GitHub repository of Bollinger Band Squeeze Detector

More Oscillators & momentum scripts

Related on ForexR

Trade Your Charts With a Regulated Broker

Compare brokers that connect to TradingView, with spreads, minimum deposits and leverage side by side.

Compare brokers