How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Feature Request FAQ Help & Wiki Twitter

# Bollinger Bands %B Bollinger Bands - Version 2

5253 4
Thanks to Chris Moody for his touch

List of All my Indicators - https://www.tradingview.com/p/stocks/?sort=recent&time=day&by=ucsgears
```//Updated by ChrisMoody on 8/14/2014 --  Original Code From ucsgears
study(title = "Bollinger Bands %B Bollinger Bands", shorttitle = "BB %B BB")
source = close
length = input(20, minval=1), mult = input(2.0, minval=0.001, maxval=50)
basis = sma(source, length)
dev = mult * stdev(source, length)
upper = basis + dev
lower = basis - dev
bbr = (source - lower)/(upper - lower)
//plot(bbr, color=teal)

basisa = sma(bbr, length)
deva = mult * stdev(bbr, length)
uppera = basisa + deva
lowera = basisa - deva

aboveUp = bbr > uppera ? 1 : 0
belowDn = bbr < lowera ? 1 : 0
plotchar(aboveUp, title="i", char='S', location=location.top, color=red, transp=0, offset=0)
plotchar(belowDn, title="i", char='B', location=location.bottom, color=green, transp=0, offset=0)

noTrade = aboveUp == 0 and belowDn == 0
bgcolor(noTrade ? gray : na, transp=50)
bgcolor(aboveUp ? red : na, transp=60)
bgcolor(belowDn ? green : na, transp=60)

col = bbr < lowera ? lime : bbr > uppera ? red : teal

//Changed your plot fills from Midline to top of band...and midline to lower band.
p1 = plot(basisa, color=silver, linewidth=0)
p2 = plot(uppera, color=red, linewidth=2)
p3 = plot(lowera, color=green, linewidth=2)
fill(p1, p2, color=red, transp = 70)
fill(p1, p3, color=green, transp = 70)
plot(bbr, color= col, style=linebr, linewidth=3)```
Trade this with the Volatility sqz indicator.
When trading Bitcoin you have to completely change everything. From red colored "sell" to show up as green "buy" and from green colored "buy" to signal in red to "sell" and only then it makes sense again... :)

ChartArt
This Works good in a market which can run and retrace. Before choosing an indicator, one needs to learn the market's nature. Taking an indicator for certain market nature and applying it in an opposite market will never work.
The intended reply is, this is not a holy grail. Infact, no indicator in the market is holy grail.
GL
Like it! Thanks!
United States
United Kingdom
India
España
France
Italia
Polska
Brasil
Россия
Türkiye
Indonesia

한국
Home Stock Screener Forex Signal Finder Economic Calendar How It Works Chart Features House Rules Moderators For the WEB Widgets Stock Charting Library Priority Support Feature Request Blog & News FAQ Help & Wiki Twitter