I personally run an additional BB 50/2 for clearer BB higher highs & lower low perspective, but it's not part of the script. Script variables are fully customisable.
I don't take ownership of any part of the script, I not a programmer /script writer just a dabbler. Enjoy :) - VDUBONG UPDATED
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.
study(title="vdubong", shorttitle="vdubong", overlay=true) length1 = input(20, minval=1, title="Upper Channel") length2 = input(20, minval=1, title="Lower Channel") upper = highest(length1) lower = lowest(length2) basis = avg(upper, lower) l = plot(lower, style=line, linewidth=1, color=fuchsia, title="lower" ) u = plot(upper, style=line, linewidth=1, color=fuchsia, title="upper") src = close, len = input(50, minval=1, title="MA") out = sma(src, len) plot(out, color=red, linewidth=2, title="MA") source = close length = input(20, minval=1), mult = input(1.5, minval=0.001, maxval=400) dev = mult * stdev(source, length) BBupper = basis + dev BBlower = basis - dev p1 = plot(BBupper, color=blue) p2 = plot(BBlower, color=blue) fill(p1, p2)