The Bollinger Bands are already present on every platform, but using the Bandwidth, the bands will be displayed only when the volatility decrease (congestion or range market).

I sometimes use this filter in mean reverting strategies to avoid signals when volatility is low. This simple correction, generally improves breakout strategies.

Firstly, we will use the Bollinger Bandwidth function which measures the BandWidth and thus the volatility.
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 increase the Bandwidth stay 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 MAKE THE BOLLINGER BANDS TRANSPARENT

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:

color_up=Argb(255,255,0,255);

In short, replace the first and the last value with a 0 and the color becomes transparent.