indicator · own pane · open source
BB Squeeze
Running…
Loading chart…
About
BB Squeeze plots Bollinger Bandwidth alongside a Keltner-equivalent width — when BBW falls inside the KC envelope, volatility is compressed.
- Background highlights the squeeze.
- Watch for the squeeze to release (BBW crossing back above the KC width) — that's the breakout.
Source code
//@version=5
indicator("BB Squeeze", overlay=false)
len = input.int(20, "Length", minval=2, maxval=200)
bbMult = input.float(2, "BB multiplier", minval=0.5, maxval=5, step=0.1)
kcMult = input.float(1.5, "KC multiplier", minval=0.5, maxval=5, step=0.1)
bbw = ta.bbw(close, len, bbMult)
[km, ku, kl] = ta.kc(close, len, kcMult)
kcw = (ku - kl) / (ta.sma(close, len) * 0.1)
sqz = bbw < kcw
hline(0, "Zero", color=color.gray)
p_BBW = plot(bbw, "BBW", color=color.red, linewidth=2)
p_KCW = plot(kcw, "KCW", color=color.blue)
No comments yet.
Sign in to comment.