Indicator · Pine Script v4 · Own pane

RSTRsi

by readysetcryptocodes· code credited to mrx_the_unknown

This indicator calculates and plots two Relative Strength Index (RSI) lines in an oscillator pane alongside standard reference bands at 30, 50, and 70.

View on GitHub

Repaints

GitHub stars43on the repository
Pine versionv4older, still runs
Lines of code41
Settings6inputs
LicenceNone statedfile: MPL-2.0
Last update2 years ago2 Jul 2024

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

41 lines of Pine Script v4 from scripts/RST_Rsi.txt, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

RST_Rsi.txt
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © mrx_the_unknown

//@version=4
study("RSTRsi", shorttitle="RSTRsi")
sep0 = input(true, "Information: On 3min timeframe RSI 2 gets overwritten by RSI with a length of 2 on the 10min timeframe")
sep1 = input(true, "Information: On 15min timeframe RSI 2 gets overwritten by RSI with a length of 2 on the 60min timeframe")
rsi1Show = input(true, title="RSI 1 Show?")
rsi2Show = input(true, title="RSI 2 Show?")

rsi1Len = input(title="RSI 1 Length", type=input.integer, defval=2)
rsi2Len = input(title="RSI 2 Length", type=input.integer, defval=10)

rsiSrc = close
rsiLower = 30
rsiUpper = 70

var float rsi1 = na
var float rsi2 = na

rsi2_15min =security(syminfo.tickerid, "60", rsi(rsiSrc, 2), barmerge.gaps_off, barmerge.lookahead_on)
rsi2_3min = security(syminfo.tickerid, "10", rsi(rsiSrc, 2), barmerge.gaps_off, barmerge.lookahead_on)

if (timeframe.period == "15")
    rsi1 := rsi(rsiSrc, rsi1Len)
    rsi2 := rsi2_15min
else if (timeframe.period == "3")
    rsi1 := rsi(rsiSrc, rsi1Len)
    rsi2 := rsi2_3min
else if (timeframe.isintraday or timeframe.isdaily)
    rsi1 := rsi(rsiSrc, rsi1Len)
    rsi2 := rsi(rsiSrc, rsi2Len)

plot(rsi1Show ? rsi1 : na, title="RSI1", linewidth=1, color=color.white, transp=0)
plot(rsi2Show ? rsi2 : na, title="RSI2", linewidth=2, color=color.aqua, transp=0)

hline(50, title="Middle Level", linestyle=hline.style_dotted)
rsiLowerPlot = hline(rsiLower, title="RsiLower", linestyle=hline.style_dashed)
rsiUpperPlot = hline(rsiUpper, title="RsiUpper", linestyle=hline.style_dashed)

fill(rsiLowerPlot, rsiUpperPlot, color=#9915ff, transp=90)

Overview

By default, it plots a short-period RSI and a secondary RSI. On the 3-minute and 15-minute chart intervals, the secondary RSI is overridden with higher-timeframe data from the 10-minute and 60-minute charts, respectively. Notably, the security calls use lookahead enabled without bar offsets, causing historical repainting on those specific intervals.

Details

Published by

readysetcryptocodes on GitHub

Code credit

mrx_the_unknown, as written in the script's header

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Category

Oscillators & momentum

Markets

Any symbol

Timeframes

M1-M5, M15-H1

Risk Notes

  • Signals can change on the live bar or after it closes (repainting)
  • Reads higher-timeframe data with lookahead on, so the history can show signals that were not there in real time

Settings

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

SettingTypeDefaultVariable
Information: On 3min timeframe RSI 2 gets overwritten by RSI with a length of 2 on the 10min timeframebooltruesep0
Information: On 15min timeframe RSI 2 gets overwritten by RSI with a length of 2 on the 60min timeframebooltruesep1
RSI 1 Show?booltruersi1Show
RSI 2 Show?booltruersi2Show
RSI 1 Lengthint2rsi1Len
RSI 2 Lengthint10rsi2Len
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
948 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 10 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

KD指標

by TaichiS
219 stars

This script calculates and plots a Stochastic Oscillator (KD indicator) in a separate chart pane. It determines the fast stochastic value over a 9-period lookback, then applies a 3-period Simple Moving Average (SMA) to create the %K line, and a second 3-period

Indicator v4 Oscillators & momentum
Updated 5 years ago · None stated GitHub repository of KD指標

More indicators

Trade Your Charts With a Regulated Broker

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

Compare brokers