RSI with levels

© Created by Alex Fernandez

Creation through Pine Script of an RSI (Relative Strength Index) tool on a dynamic chart, using the tool directly in this chart for better and easier analysis. Different RSI levels were added, each with its own color. The tool is easily modifiable by the user through a GUI, being able to modify the RSI time, the colors of the levels and the levels that appear on the chart, among other things.

In the code you can see 9 different values, a mid value of 50, four higher values, and another four lower values; corresponding to the different programmed RSI levels.

 

// © Alex Fernandez
//@version=4
study(“RSI Levels, 15-30 & 70-85 with 50″, shorttitle=”RSI Levels with 50”, overlay=true)
length = input(14, title=”RSI Length”)
eightyfive = 85
eighty = 80
seventyfive = 75
seventy = 70
fifty = 50
thirty = 30
twentyfive = 25
twenty = 20
fifteen = 15
ep = 2 * length – 1
auc = ema( max( close – close[1], 0 ), ep )
adc = ema( max( close[1] – close, 0 ), ep )
x1 = (length – 1) * ( adc * thirty / (100-thirty) – auc)
thirtyrsi = iff( x1 >= 0, close + x1, close + x1 * (100-thirty)/thirty )
x2 = (length – 1) * ( adc * twentyfive / (100-twentyfive) – auc)
twentyfiversi = iff( x2 >= 0, close + x2, close + x2 * (100-twentyfive)/twentyfive )
x3 = (length – 1) * ( adc * twenty / (100-twenty) – auc)
twentyrsi = iff( x3 >= 0, close + x3, close + x3 * (100-twenty)/twenty )
x4 = (length – 1) * ( adc * fifteen / (100-fifteen) – auc)
fifteenrsi = iff( x4 >= 0, close + x4, close + x4 * (100-fifteen)/fifteen )
x5 = (length – 1) * ( adc * seventy / (100-seventy) – auc)
seventyrsi = iff( x5 >= 0, close + x5, close + x5 * (100-seventy)/seventy )
x6 = (length – 1) * ( adc * seventyfive / (100-seventyfive) – auc)
seventyfiversi = iff( x6 >= 0, close + x6, close + x6 * (100-seventyfive)/seventyfive )
x7 = (length – 1) * ( adc * eighty / (100-eighty) – auc)
eightyrsi = iff( x7 >= 0, close + x7, close + x7 * (100-eighty)/eighty )
x8 = (length – 1) * ( adc * eightyfive / (100-eightyfive) – auc)
eightyfiversi = iff( x8 >= 0, close + x8, close + x8 * (100-eightyfive)/eightyfive )
x9 = (length – 1) * ( adc * fifty / (100-fifty) – auc)
fiftyrsi = iff( x9 >= 0, close + x9, close + x9 * (100-fifty)/fifty )
thirtyrsiplot = plot( thirtyrsi, title=”30″, color=#F6F9C2, linewidth=1)
plot( twentyfiversi, title=”25″, color=#EEEE00, linewidth=2)
plot( twentyrsi, title=”20″, color=#EABB35, linewidth=3)
fifteenrsiplot = plot( fifteenrsi, title=”15″, color=#7F0100, linewidth=4)
fiftyrsiplot = plot( fiftyrsi, title=”50″, color=#00FF00, linewidth=2)
seventyrsiplot = plot( seventyrsi, title=”70″, color=#F6F9C2, linewidth=1)
plot( seventyfiversi, title=”75″, color=#EEEE00, linewidth=2)
plot( eightyrsi, title=”80″, color=#EABB35, linewidth=3)
eightyfiversiplot = plot( eightyfiversi, title=”85″, color=#7F0100, linewidth=4)
fill(thirtyrsiplot,
fifteenrsiplot,
color=#6E1979,transp=90)
fill(seventyrsiplot,
eightyfiversiplot,
color=#6E1979,transp=90)

You can see how the RSI looks on the chart in this screenshot

en_GBEN

Cookie Policy

This website uses cookies to ensure you get the best experience on our website.

Go It!