I have been searching the forums for some code without success which helps identifies assets where the Bollinger Bands are squeezing togther during the past (x) periods. Is anyone able to help please. Thanks in advance.
Simon
JSParticipant
Veteran
Hi Simon,
You can try the screener below…
In this screener, the BBWidth is the “narrowest” over the last 120 (trading) days…
(You can change the number of days)
BBWidth=BollingerBandWidth[20](Close)
C1=BBWidth<=Lowest[120](BBWidth) //120 trading days
Screener[C1]
Thank JS appreciate your reply. On second thoughts what I think I am really looking for is a period (x) of time where the lower and upper bands are moving sideways. Thanks.
JSParticipant
Veteran
Hi Simon,
I don’t think Bollinger Bands are really suitable for that, Bollinger Bands is more of “inflating” and “deflating” than “sideways”…
Maybe you can use a Dochian indicator instead of the BB…
Might look something like this:
xDiff=DonchianChannelUp[period]-DonchianChannelDown[period]
C1=xDiff=Lowest[period](xDiff)
When a Donchian Channel decreases/shrinks over time, then the probability of an outbreak is higher…?