OPEN-SOURCE SCRIPT

Reverse RSI

131
//version=6
indicator("Reverse RSI", overlay=false)

rsi_length = input.int(14, title="RSI Length", minval=1)
ob_level = input.int(75, title="Overbought Level")
os_level = input.int(25, title="Oversold Level")

invRSI(target, length) =>
target_rs = target / (100 - target)

up = math.max(close-close[1], 0)
down = math.max(close[1]-close, 0)

prev_avg_up = ta.rma(up, length)
prev_avg_down = ta.rma(down, length)


price_up = target_rs * (prev_avg_down * (length - 1)) - (prev_avg_up * (length - 1)) + close
price_down = (prev_avg_down * (length - 1) - (prev_avg_up * (length - 1)) / target_rs) + close

current_rsi = ta.rsi(close, length)
price = target > current_rsi ? price_up : price_down
price

price_ob = invRSI(ob_level, rsi_length)
price_mid = invRSI(50, rsi_length)
price_os = invRSI(os_level, rsi_length)

upside = (price_ob-close)/close*100
downside = (close-price_os)/close*100
net = upside-downside

plot(upside, title="Upside Line", color=color.green)
plot(downside, title="Downside Line", color=color.red)
plot(net, title="Net Line", color=net>0?color.new(color.green, 30):color.new(color.red, 30), style=plot.style_columns)

hline(0, "Zero Line")

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, alım satım veya diğer türden tavsiye veya öneriler anlamına gelmez ve teşkil etmez. Kullanım Koşulları bölümünde daha fazlasını okuyun.