pine-scriptpine-script-v5rsi

lock RSI screen to 0-100


is it possible to lock RSI screen range 0-100 only?

//@version=5
indicator(title="Relative Strength Index", shorttitle="RSI", format=format.price, precision=2, timeframe="", timeframe_gaps=true)
len = input.int(14, minval=1, title="Length")
src = input(close, "Source")
up = ta.rma(math.max(ta.change(src), 0), len)
down = ta.rma(-math.min(ta.change(src), 0), len)
rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
plot(rsi, "RSI", color=#ffffff)
band1 = hline(60, "Upper Band", color=#787B86)
bandm = hline(50, "Middle Band", color=color.new(#787B86, 50))
band0 = hline(40, "Lower Band", color=#787B86)


Solution

  • You can not set up the scale to be fixed at your defined range. Sorry.