Untitled
unknown
plain_text
a year ago
733 B
19
Indexable
//@version=5 indicator(title='Bollinger Bands Width with Squeeze Alert', shorttitle='BBW with Squeeze', precision=2) comp_len = input(125, 'Back comparison period for squeeze detection (bars)') length = input.int(20, minval=1) src = input(close, title='Source') mult = input.float(2.0, minval=0.001, maxval=50) bbwidth() => basis = ta.sma(src, length) dev = mult * ta.stdev(src, length) upper = basis + dev lower = basis - dev (upper - lower) / basis bbw = bbwidth() squeeze = bbw == ta.lowest(bbw, comp_len) bgcolor(squeeze ? color.fuchsia : na, transp=75) plot(bbw, 'BBW', color=color.new(#138484, 0)) hline(0) alertcondition(squeeze, 'Bollinger Squeeze ', 'Bollinger Squeeze ')
Editor is loading...
Leave a Comment