indicator · own pane · open source
Relative Strength Index
Running…
Loading chart…
About
Relative Strength Index (RSI) is Wilder's classic 0-100 momentum oscillator: average gains over average losses.
- Above 70 = overbought, below 30 = oversold (adjustable via the inputs).
- Raise
Lengthfor fewer, higher-quality signals in choppy markets. - Watch divergences between RSI and price making for higher-probability turns.
Source code
//@version=5
indicator("Relative Strength Index", overlay=false)
len = input.int(14, "Length", minval=2, maxval=200)
src = input.source("close", "Source")
ob = input.int(70, "Overbought", minval=50, maxval=95)
os = input.int(30, "Oversold", minval=5, maxval=50)
rsi = ta.rsi(src, len)
hline(70, "Overbought", color=color.gray, linestyle=hline.style_dashed)
hline(30, "Oversold", color=color.gray, linestyle=hline.style_dashed)
hline(50, "Midline", color=color.gray, linestyle=hline.style_dotted)
p_RSI = plot(rsi, "RSI", color=color.purple, linewidth=2)
alertcondition(ta.crossunder(rsi, 30), "RSI oversold", "RSI crossed below oversold")
alertcondition(ta.crossover(rsi, 70), "RSI overbought", "RSI crossed above overbought")
No comments yet.
Sign in to comment.