The Bollinger Bands are already present on every platform, but using the Bollinger Bands Bandwidth Indicator, the bands will be displayed only when the volatility decreases (during periods of “congestion” or during a range-bound market).
I sometimes use this filter in mean-reverting strategies to avoid signals when volatility is low. This simple correction generally improves breakout strategies.
How to Create a Bollinger BandWidth Indicator
Firstly, we will use the Bollinger Bandwidth function which measures the BandWidth and thus the volatility of a given financial instrument.
We begin to draw the Bollinger Bands with simple code, slightly different from what you find on the platform:
After that, we have to code the slow and fast Bandwidth and its moving average:
The result will be the distance between the bands. However, we do not just need the distance, so we’ll have to compare a fast Bandwidth with a slower one. In this example, we use a 50-period moving average.
If volatility increases the Bandwidth stays above its moving average.
In addition, we insert the fast Bandwidth above the slow Bandwidth so you can have four types of volatility already usable:
The indicator will draw congestions like this:
How to “draw” Transparent Bollinger Bands
To display the Bollinger Bands BandWidth only during the phases of decreasing volatility, I used the Argb function.
With this function, we can define the colors in Easylanguage for only TradeStation and have much more flexibility than the few preset colors.
The code looks like this:
In short, replace the first and the last value with a 0 and the color becomes transparent.
Bollinger Bands BandWidth Indicator Download
More from Finance Strategy System
BOLLINGERBANDS.COM: What are Bollinger Bands?