Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- study(title="Relative Strength Index", shorttitle="RSI")
- src = close, len = input(14, minval=1, title="Length")
- up = rma(max(change(src), 0), len)
- down = rma(-min(change(src), 0), len)
- rsi = down == 0 ? 100 : up == 0 ? 0 : 100 - (100 / (1 + up / down))
- plot(rsi, color=black)
- band1 = hline(70)
- band0 = hline(30)
- fill(band1, band0, color=purple, transp=90)
- hline(50, linestyle = dotted, color= black, title= "Center")
- sma=sma(rsi, 9)
- plot(sma(rsi, 9), color= red)
- upper = hline(70)
- lower = hline(30)
- fill (upper, lower)
- s1=rsi[1] > sma[1] and rsi < sma and rsi[1]>70
- s2=rsi[1] < sma[1] and rsi > sma and rsi[1]<20
- bgcolor(s1 ? red : na, transp=30)
- bgcolor(s2 ? green : na, transp=30)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement