Indicator · Pine Script v4 · On the chart

Test

by blackcat1402

This indicator plots a small red label above price bars when a custom relative strength reading crosses down through a user-set pivot.

View on GitHub

GitHub stars3on the repository
Pine versionv4older, still runs
Lines of code48
Settings2inputs
LicenceMIT
Last update5 years ago19 Dec 2020

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

48 lines of Pine Script v4 from indicator/single/relative_strength.pine, published under MIT. Keep the author's credit and licence lines when you reuse it.

relative_strength.pine
//@version=4



// -------------------------------------------------------------------------- //



study(title="Test", shorttitle="Test", overlay=true)



// -------------------------------------------------------------------------- //



rsl = input(title="RSI Length", type=input.integer, defval=21, minval=1, step=1)
rsp = input(title="RSI Pivot",  type=input.integer, defval=60, minval=1, step=1)



// new_crb returns true if the current bar is red, that is, the current open
// price is higher than the current close price. This signals a local downward
// movement. Here crb means current red bar.
new_crb() =>
    open > close

// new_hpb returns the relative strength indicator for the current bar, based on
// the running moving average. Here rsb means relative strength bar.
new_rsb(src, rsl) =>
    upw = rma( max(change(src), 0), rsl)
    dow = rma(-min(change(src), 0), rsl)

    dow == 0 ? 100 : upw == 0 ? 0 : 100 - (100 / (1 + upw / dow))

// new_rsi returns the relative strength indicator for overbought price peaks.
// If the RSI band crosses under the RSI turning point given by rsp then new_rsi
// returns true.
new_rsi(src, rsl, rsp) =>
    new_rsb(src, rsl)[1] > rsp and new_rsb(src, rsl)[0] < rsp



// -------------------------------------------------------------------------- //



plotshape(new_rsi(close, rsl, rsp), text="RSI", location=location.abovebar, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)

Overview

Test builds the reading from running moving averages of upward and downward close changes, in the same form as RSI. The RSI length controls the smoothing window and the RSI pivot sets the overbought threshold that must be crossed from above. It draws on the price chart and only marks that downward cross; it does not generate exits, stops, or position sizing.

Details

Published by

blackcat1402 on GitHub

Type

Indicator, Pine Script v4

Draws

On the price chart

Category

Oscillators & momentum

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
RSI Lengthint21rsl
RSI Pivotint60rsp
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

948 stars

The Adaptive RSI Moving Average (ARSIMA) is an overlay indicator that dynamically adjusts its smoothing factor based on the Relative Strength Index (RSI). When the RSI moves toward extreme overbought or oversold conditions, the smoothing factor increases to ma

Indicator v4 Moving averagesOscillators & momentum
Updated 10 days ago · GPL-3.0 GitHub repository of Adaptive RSI Moving Average

This overlay indicator screens a pasted list of up to forty symbols and draws a table on the price chart. It classifies bullish or bearish setups from the percent change between the current candle and the candle 250 bars back, then shows RSI with a simple movi

Indicator v5 Oscillators & momentumVolume
Updated 1 year ago · MPL-2.0 GitHub repository of Momentum Setup - Ankush Bajaj Momentum Investing Setup

This indicator plots trade entry and exit signals on the price chart by combining Bollinger Bands with optional filter conditions. It calculates standard Bollinger Bands along with RSI, Aroon, and moving average filters. Reversal signals trigger when price bre

Indicator v4 Volatility & bandsOscillators & momentum
Updated 2 months ago · None stated GitHub repository of Bollinger Bands Winner IND [Alorse]
318 stars

This indicator plots three moving averages on the price chart alongside colored fills between the lines to visualize trend structure. Internally, it calculates a Stochastic RSI oscillator to detect oversold reversals. When the Stochastic %K line rises above 10

Indicator v5 Moving averagesOscillators & momentum
Updated 2 months ago · MIT GitHub repository of TVT 3X Scale In Out
285 stars

Mean Reversion Study is an indicator that identifies trade setups combining exponential moving averages, RSI extremes, and engulfing candlestick patterns. It highlights bullish setups when a bullish engulfing candle forms below the EMA while RSI is oversold, a

Indicator v4 Mean reversionCandlestick patterns
Updated 3 years ago · None stated GitHub repository of Mean Reversion Study

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