ucsgears

Bollinger Bands %B Bollinger Bands - Version 2

4360 4 1255
Thanks to Chris Moody for his touch

List of All my Indicators - https://www.tradingview.com/p/stocks/?sort=recent&time=day&by=ucsgears
Remove from Favorite Scripts Add to Favorite Scripts
//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
 
//Added This
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)
 
//Added in BackGround Hilighting
noTrade = aboveUp == 0 and belowDn == 0
bgcolor(noTrade ? gray : na, transp=50)
bgcolor(aboveUp ? red : na, transp=60)
bgcolor(belowDn ? green : na, transp=60)
 
//Added This
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)
ucsgears PRO
2 years ago
Trade this with the Volatility sqz indicator.
Reply
ChartArt
2 years ago
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... :)

snapshot
+1 Reply
ucsgears PRO ChartArt
2 years ago
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
+1 Reply
Like it! Thanks!
Reply
Ideas Scripts Chart
United States
United Kingdom
India
España
Italia
Brasil
Россия
Türkiye
日本
한국
Home Stock Screener 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
Private Messages Chat Ideas Published Followers Following Priority Support Public Profile Profile Settings Billing Sign Out