vdubus

VDUB BB %B REVERSAL_v3

Updated BB %B REVERSAL_v2 with Trading session background

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(title = "VDUB BB %B REVERSAL_v3", shorttitle = "vdub_BB_%B_rev_v3")
length = input(21, minval=1)
src = input(close, title="Source")
mult = input(0.001, minval=0.001, maxval=50)
basis = sma(src, length)
dev = mult * stdev(src, length)
upper = basis + dev
lower = basis - dev
bbr = (src - lower)/(upper - lower)
plot(bbr, color=teal, style=histogram, linewidth=4)
plot(bbr, color=black, style=line, linewidth=2)

//========================bgcolor=================================

timeinrange(res, sess) => time(res, sess) != 0
premarket = #0050FF
regular = #0000FF
postmarket = #5000FF
notrading = na
sessioncolor = timeinrange("30", "0400-0930") ? premarket : timeinrange("30", "0930-1600") ? regular : timeinrange("30", "1600-2000") ? postmarket : notrading
bgcolor(sessioncolor, transp=85)

Related Ideas