An indicator with 10 configurable %B lines for identifying trends, overbought and oversold conditions, and reversal points. %B is a linear representation of a securities relationship to the Upper and Lower Bollinger Bands. The best opportunities arise when a security is oversold in a bullish trend and overbought in a bearish trend. The longer %B trend-lines in this indicator are very useful for major reversals. They can be used to indicate the high or low of the day on a 1-minute chart or show a multi-year reversal point.
%B = (Current Price - Lower Band) / (Upper Band - Lower Band)
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?
//%B’s by NVRSTPEXPLORING
//%B is a linear representation of a securities relationship to the Upper and Lower Bollinger Bands
//It is useful for identifying overbought and oversold conditions 
//The best opportunities arise when a security is oversold in a bullish trend and overbought in a bearish trend
//The longer %B Trendlines are very useful for major reversals. They can indicate the high or low of the day on a 1minute chart or show a multi-year reversal point.
//%B = (Current Price - Lower Band) / (Upper Band - Lower Band)
study(title = "Bollinger Bands %B's", shorttitle = "%B")
src = input(close, title="Source")
mult = input(2.0, minval=0.001, maxval=50)
sh1 = input(title='Hide 2584?', type=bool, defval=false)
sh2 = input(title='Hide 1597?', type=bool, defval=false)
sh3 = input(title='Hide 987?', type=bool, defval=false)
sh4 = input(title='Hide 610?', type=bool, defval=false)
sh5 = input(title='Hide 377?', type=bool, defval=false)
sh6 = input(title='Hide 233?', type=bool, defval=false)
sh7 = input(title='Hide 144?', type=bool, defval=false)
sh8 = input(title='Hide 89?', type=bool, defval=false)
sh9 = input(title='Hide 55?', type=bool, defval=false)
sh10 = input(title='Hide 34?', type=bool, defval=false)

//
length1 = input(2584, minval=1)
basis1 = sma(src, length1)
dev1 = mult * stdev(src, length1)
upp1 = (basis1 + dev1)
low1 = (basis1-dev1)
bb1 = (src-low1)/(upp1-low1)
p1 = plot(sh1? na: bb1,color= bb1>=1? #d3582f: bb1 <=0? #235a4a: #4A235A,title='2584', linewidth=4, transp=45)
//
length2 = input(1597, minval=1)
basis2 = sma(src, length2)
dev2 = mult * stdev(src, length2)
upp2 = (basis2 + dev2)
low2 = (basis2-dev2)
bb2 = (src-low2)/(upp2-low2)
p2 = plot(sh2? na: bb2, color= bb2>=1? #d3582f: bb2 <=0? #235a4a: #4A235A,title='1597', linewidth=3, transp=40)
//
length3 = input(987, minval=1)
basis3 = sma(src, length3)
dev3 = mult * stdev(src, length3)
upp3 = (basis3 + dev3)
low3 = (basis3-dev3)
bb3 = (src-low3)/(upp3-low3)
p3 = plot(sh3? na: bb3, color= bb3>=1? #d3582f: bb3 <=0? #235a4a: #4A235A,title='987', linewidth=3, transp=35)
//
length4 = input(610, minval=1)
basis4 = sma(src, length4)
dev4 = mult * stdev(src, length4)
upp4 = (basis4 + dev4)
low4 = (basis4-dev4)
bb4 = (src-low4)/(upp4-low4)
p4 = plot(sh4? na: bb4,color= bb4>=1? #d3582f: bb4 <=0? #235a4a: #4A235A,title='610', linewidth=3, transp=30)
//
length5 = input(377, minval=1)
basis5 = sma(src, length5)
dev5 = mult * stdev(src, length5)
upp5 = (basis5 + dev5)
low5 = (basis5-dev5)
bb5 = (src-low5)/(upp5-low5)
p5 = plot(sh5? na: bb5, color= bb5>=1? #d3582f: bb5 <=0? #235a4a: #4A235A,title='377', linewidth=3, transp=25)
//
length6 = input(233, minval=1)
basis6 = sma(src, length6)
dev6 = mult * stdev(src, length6)
upp6 = (basis6 + dev6)
low6 = (basis6-dev6)
bb6 = (src-low6)/(upp6-low6)
p6 = plot(sh6? na: bb6, color= bb6>=1? #d3582f: bb6 <=0? #235a4a: #4A235A,title='233', linewidth=2, transp=20)
//
length7 = input(144, minval=1)
basis7 = sma(src, length7)
dev7 = mult * stdev(src, length7)
upp7 = (basis7 + dev7)
low7 = (basis7-dev7)
bb7 = (src-low7)/(upp7-low7)
p7 = plot(sh7? na: bb7, color= bb7>=1? #d3582f: bb7 <=0? #235a4a: #4A235A,title='144', linewidth=2, transp=15)
//
length8 = input(89, minval=1)
basis8 = sma(src, length8)
dev8 = mult * stdev(src, length8)
upp8 = (basis8 + dev8)
low8 = (basis8-dev8)
bb8 = (src-low8)/(upp8-low8)
p8 = plot(sh8? na: bb8, color= bb8>=1? #d3582f: bb8 <=0? #235a4a: #4A235A,title='89', linewidth=2, transp=10)
//
length9 = input(55, minval=1)
basis9 = sma(src, length9)
dev9 = mult * stdev(src, length9)
upp9 = (basis9 + dev9)
low9 = (basis9-dev9)
bb9 = (src-low9)/(upp9-low9)
p9 = plot(sh9? na: bb9, color= bb9>=1? #d3582f: bb9 <=0? #235a4a: #4A235A,title='55', linewidth=1, transp=5)
//
length10 = input(34, minval=1)
basis10 = sma(src, length10)
dev10 = mult * stdev(src, length10)
upp10 = (basis10 + dev10)
low10 = (basis10-dev10)
bb10 = (src-low10)/(upp10-low10)
p10 = plot(sh10? na: bb10, color= bb10>=1? #d3582f: bb10 <=0? #235a4a: #4A235A,title='34', linewidth=1, transp=0)
//
band1 = hline(1, color=#800000, linestyle=dashed, linewidth=1)
band0 = hline(0, color=#008000, linestyle=dashed, linewidth=1)
fill(band1, band0, color=#2f235a)