Bearish Bollinger Squeeze
The Bollinger band plots a moving average together with an upper and lower band. The width of the band is a measure of the price volatility at that point. A Bollinger squeeze is where the price volatility becomes temporarily suppressed over a short time. Squeezes often end with a strong breakout either to the upside or downside. The chart below shows a typical squeeze event.
This indicator detects bearish Bollinger squeezes. To begin, go the Indicator Builder. Next add a Subtract operator. Set the first input to Bollinger Band. Click the cogs icon to adjust the settings for the Bollinger band. Set the length to 50 bars, or as required then click save to store the settings.
Now copy the first row into the second input of the Subtract operator. To do this, drag the Bollinger band row whilst holding down the CTRL key and drop it on the second input placeholder.
Set the selector in the first Bollinger band to Upper and the second to Lower as in the image above. The subtract will then give the band width.
Click the top row, then click the plus icon in the toolbar to add a new row above it. Set that to a Less Than or Equal operator. Then set the second input to Min. Then copy the Subtract stub to the input of the Min operator. To do this, drag the row whilst holding CTRL, then drop it over the input row placeholder. The result should now look like the image above.
The logic so far tells us where the Bollinger bandwidth is the narrowest over the last 50 bars, which is the default length for the Min operator.
Since we only want the first bar where this event starts, add a Dirac Delta function, then a Threshold function as shown in the image below. The Less Than or Equal stub is collapsed here to make the structure easier to read.
Click the preview icon (spyglass) in the Threshold row. It should look something like the image above.
For a bearish squeeze, we want to confirm that the price line is rising during the squeeze period. To do this, add an And operator in the top row. Set the second input to Greater Than and it’s input to Moving average of a Gradient as shown in the image above.
Next set the Moving Average length to 30 and the Gradient length to 7.
Finally, add a Sell operator in the top row. Then on clicking preview, confirm that the indicator does indeed detect the bearish Bollinger squeezes.