indicator · own pane · open source

Bollinger %B indicator

Bollinger %B is a free open-source indicator. Bollinger %B plots where price sits inside its Bollinger Bands, scaled 0-1. Deepwick Script runs a subset of Pine Script.

v1Updated 3 Oct 2026▲ 0 users
Running…
Loading chart…

What Bollinger %B does

Bollinger %B plots where price sits inside its Bollinger Bands, scaled 0-1. Above 1 = above upper band, below 0 = below lower band.

  • Reads 0-20% = stretched down, 80-100% = stretched up.
  • Crossover of 1.0 or 0.0 flags band breaks.
  • Pair with Bandwidth for squeeze detection.

Source code

Deepwick Script, a subset of Pine Script · read-only

//@version=6
indicator("Bollinger %B", overlay=false)
len = input.int(20, "Length", minval=2, maxval=200)
mult = input.float(2, "Mult", minval=0.5, maxval=5, step=0.1)
src = input.source(close, "Source")
colorLine = input.color("color.blue", "Color  Line")
colorNeutral = input.color("color.gray", "Color  Neutral")
[m, u, l] = ta.bb(src, len, mult)
pb = (src - l) / (u - l)
hline(1, "Upper Band", color=colorNeutral, linestyle=hline.style_dashed)
hline(0, "Lower Band", color=colorNeutral, linestyle=hline.style_dashed)
hline(0.5, "Midline", color=colorNeutral, linestyle=hline.style_dotted)
p__B = plot(pb, "%B", color=colorLine, linewidth=2)
alertcondition(ta.crossover(pb, 1), "%B above upper", "Price closed above upper band")
alertcondition(ta.crossunder(pb, 0), "%B below lower", "Price closed below lower band")

Comments

No comments yet.

Sign in to comment.