lix

LX Rsi Divergence Bars

This script colours the bars when they are below or boyond a specified RSI threshold
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
study("LX Rsi Divergence Bars", shorttitle="LiX_RSIBARS", overlay=true)
//r = rising(ohlc4,6)
//rb = close + highestbars(close,6)
rsiperiod = input(title="RSI Period", type=integer, defval=21)
overb = input(title="Overbought", type=integer, defval=70)
oversold = input(title="Oversold", type=integer, defval=30)
rsbar = rsi(close,rsiperiod)
//clr = rsbar > 60 ? open < close ? 4 : na : na
//plot(clr,title="200 price",color=#3399FF,transp=90)
//bgcolor(close < open ? red : green, transp=70)
//barcolor(close < open ? silver : #3C78D8)
barcolor(rsbar >= overb ? open < close ? green : na : na) // moves in the trend of overbought
barcolor(rsbar >= overb ? open > close ? red : na : na) // diverging bar

barcolor(rsbar <= oversold ? open < close ? green : na : na) // diverging bar
barcolor(rsbar <= oversold ? open > close ? gray : na : na) // moves in the trend of oversold