Indicator · Pine Script v4 · Own pane

RSI & EMA with Reverse Calculator Panel

by Anderson-ALGO· code credited to balipour

This indicator calculates and plots the Relative Strength Index (RSI) alongside an Exponential Moving Average (EMA) of the RSI in a separate pane.

View on GitHub

GitHub stars9on the repository
Pine versionv4older, still runs
Lines of code110
Settings13inputs
LicenceNone statedfile: MPL-2.0
Last update5 years ago30 Nov 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

110 lines of Pine Script v4 from Pine/Pine Wizards/Balipur/RSI & EMA with Reverse Calculator Panel.pine, published under MPL-2.0 (file header). Keep the author's credit and licence lines when you reuse it.

RSI & EMA with Reverse Calculator Panel.pine
// This source code is subject to the terms of the Mozilla Public License 2.0 at https://mozilla.org/MPL/2.0/
// © balipour

//@version=4
study(title="RSI & EMA with Reverse Calculator Panel [pig]", shorttitle="BA🐷 RSI & EMA", overlay=false)

bgcolor(#000000c0)

//Settings
src    = input(close,                            "===== Source =====", input.source)
len    = input(14,                                       "RSI Length", input.integer, minval=2)
lenema = input(12,                                       "EMA Length", input.integer, minval=2)
ob     = input(70.0,                               "Overbought Input", input.float,minval=0,step=5)
os     = input(30.0,                                 "Oversold Input", input.float,minval=0,step=5)
pan    = input(true,                        " Show Information Panel",  input.bool )
off    = input(35,                          "  Panel Position Offset",  input.integer, minval=0)
s      = input(true,                   "Show Entered RSI Price Level",  input.bool )
ersi   = input(40.0,                            "  Entered RSI Input",  input.float)
s2     = input(false,                "Show RSI Level for Input Price",  input.bool )
ip     = input(10000,                       "  Entered Price for RSI",  input.float)
dec    = input(1,                                          "Decimals",  input.integer, minval=0 , maxval = 10)
bg     = input(false,                           "Invisible Background",  input.bool )

//Reverse RSI Functions
reverse(Level) =>
    x1 = (len - 1) * (rma(max(nz(src[1],src) - src, 0), len) * Level / (100 - Level) - rma(max(src - nz(src[1],src), 0), len))
    iff(x1 >= 0, src + x1, src + x1 * (100 - Level) / Level)

//RSI
rsi = rsi(src,len)

//RSIEMA
ma = ema(rsi, lenema)

//Reverse RSI Price Level Calculations
revma = reverse(ma)
revob = reverse(ob)
revos = reverse(os)
reversi = reverse(ersi)

//Reverse Reverse RSI
rr(input)=>
    alpha = 1 / len
    up1 = rma(max(change(src),0),len) 
    down1 = rma(-min(change(src), 0), len)
    up = alpha * max(input - src[1], 0) + (1 - alpha)*nz(up1[1])
    down = alpha * -min(input - src[1], 0) + (1 - alpha)*nz(down1[1])
    rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))


rrrsi = rr(ip)


//Plots

plot(rsi, color=#40E0D0, linewidth=2, transp=0)
plot(ma, "EMA", color=color.white, style=plot.style_line, transp=0, linewidth=1)


bullzoneband = hline(65, "Bull Lower Zone", color=#40E0D0, linewidth=2, linestyle=hline.style_dotted)
upband = hline(80, "Bull Uppe Zoner", color=#40E0D0, linewidth=2)
fill(upband, bullzoneband, color=#40E0D0, transp=90)

bearzoneband = hline(45, "Bear Upper Zone", color=#9400D3, linewidth=2, linestyle=hline.style_dotted)
downband = hline(30, "Bear Lower Zone", color=#9400D3, linewidth=2)
fill(bearzoneband, downband, color=#9400D3, transp=90)

hline(50)
plot(s ? ersi : na, "Entered RSI Value", color = color.lime, trackprice = true ,show_last = 1)
plot(s2 ? rrrsi : na, "RSI Value for Entered Price", color = color.red, trackprice = true ,show_last = 1)
//Information Panel
labelstyle = label.style_label_center
labelstyle2 = label.style_label_down

labelc = bg ? color.new(#000000, 100) : color.new(#000000, 45)



//Round Function
Round(src, digits) => 
    p = pow(10,digits)
    round(abs(src)*p)/p*sign(src)

//Offset 
xp(offset) => 
    time + round(change(time) * offset)

lable1(offset,P, T, s, color_PnL) =>
    label PnL_Label = na
    PnL_Label := label.new(xp(offset), P, text = T, color=color_PnL, textcolor=color.white, style = s, yloc=yloc.price, xloc=xloc.bar_time,size=size.normal)
    label.delete(PnL_Label[1])


ud()=>
    if rsi < ma
        "UP EMA"
    else
        "DOWN EMA"

//Panel Plot
if (pan)        
    lable1(off,50, "RSI Cross " + ud() +  " Price : " + tostring(Round(revma,dec))  + "\n\n" + tostring(Round(ob,dec)) + " Overbought Level Price : " + tostring(Round(revob,dec)) +  "\n\n" + tostring(Round(os,dec)) + " Oversold Level Price : " + tostring(Round(revos,dec)),labelstyle,labelc)


if(s)
    lable1(1,ersi, tostring(Round(ersi,dec)) + " RSI Price : " + tostring(Round(reversi,dec))  ,labelstyle2,labelc)


if(s2)
    lable1(1,rrrsi,  "RSI " + tostring(Round(rrrsi,dec)) +  " For Input Price " + tostring(Round(ip,dec)) ,labelstyle2, labelc)

Overview

RSI & EMA with Reverse Calculator Panel features a reverse RSI calculator that determines the price required to reach specific RSI targets, such as overbought, oversold, EMA RSI, or a custom RSI value. Additionally, it calculates the expected RSI for a user-specified price target and presents key data on an information panel. Users can adjust lengths, zone boundaries, and visual settings.

Details

Published by

Anderson-ALGO on GitHub

Code credit

balipour, as written in the script's header

Type

Indicator, Pine Script v4

Draws

Separate pane below the chart

Category

Oscillators & momentum, Moving averages, Screeners & dashboards

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
===== Source =====sourceclosesrc
RSI Lengthint14len
EMA Lengthint12lenema
Overbought Inputfloat70.0ob
Oversold Inputfloat30.0os
Show Information Panelbooltruepan
  Panel Position Offsetint35off
Show Entered RSI Price Levelbooltrues
  Entered RSI Inputfloat40.0ersi
Show RSI Level for Input Priceboolfalses2
  Entered Price for RSIfloat10000ip
Decimalsint1dec
Show all 13 settings
SettingTypeDefaultVariable
Invisible Backgroundboolfalsebg
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

218 stars

Multi-Timeframe Analysis Suite calculates trend direction and momentum conditions across five user-selected timeframes using moving averages, RSI, and Stochastic oscillators. It evaluates moving average slope and oscillator levels to compute trend alignment, m

Indicator v6 Screeners & dashboardsTrend
Updated 3 months ago · None stated GitHub repository of Multi-Timeframe Analysis Suite

KamaFama

by Mastaaa1987
141 stars

KamaFama is an indicator that translates a Freqtrade trading strategy into Pine Script for visualization. It combines Kaufman Adaptive Moving Average (KAMA), MAMA/FAMA calculations derived via Hilbert Transform, Williams %R, and correlation trend filters to ev

Indicator v6 Moving averagesOscillators & momentum
Updated 6 weeks ago · MIT GitHub repository of KamaFama
114 stars

Calculates normalized reversal metrics across up to ten Forex currency pairs using user-selected moving average methods, including HarmonicMA, EMA, SMA, or WMA. The indicator identifies overbought, oversold, and mean-crossing conditions using a configurable th

Indicator v4 Screeners & dashboardsMean reversion
Updated 1 year ago · None stated GitHub repository of Multi-Pair Trend Reversal Widget

Technical Ratings

by TWODS-CAPITAL
37 stars

This indicator scores price using moving averages, oscillators, or both, then maps the result to buy, sell, and neutral ratings. It compares several simple and exponential averages, a Hull average, a volume-weighted average, and Ichimoku lines with price, and

Indicator v5 Oscillators & momentumMoving averages
Updated 3 years ago · MIT GitHub repository of Technical Ratings

Strategy Scanner

by RobertAgee
34 stars

This indicator scans up to thirty symbols simultaneously against selected technical strategies, such as moving average crosses, price strength, or volume momentum. It displays long and short signals using shapes, labels, and horizontal lines directly inside a

Indicator v5 Screeners & dashboardsMoving averages
Updated 3 years ago · None stated GitHub repository of Strategy Scanner

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