# Bollinger Bandwidth

Bollinger Bandwidth provides a relative measure of the width of Bollinger Bands®.  Its most popular use is to identify "The Squeeze", but is also useful in identifying trend changes.

Custom PCF Formula
 Of Closing Prices `2 * d * STDDEVx.z / tAVGCx.z` `w`=Formula, `x`=Period, `d`=StdDev, `z`=Offset, `t`=AverageType Generalized Version `2 * d * SQR(ABS(SUM((w) ^ 2, x) - x * AVG(w, x) ^ 2) / x) / tAVG(w, x)`

Where `w` can be any formula returning a numeric value.

Where `x` is the period which must be an integer.

Where `d` is the distance between the centerline and the Bollinger Bands in multiples of the standard deviation.

Where `z` is the offset. An offset of 1 would be for one bar ago.

Where `t` is the average type. Leave blank for simple, set to X for exponential, F for front weight, and H for Hull.

### Examples

Simple Bollinger BandWidth 20, 2.00 for the current bar can be written as follows.

`2 * 2 * STDDEV20.0 / AVGC20.0`

But you can leave out the offset parameters because the current bar is just set to 0. You can also solve the `2 * 2 *` portion of the formula to just get `4 *` instead.

`4 * STDDEV20 / AVGC20`

The simple Bollinger BandWidth 50, 2.00 would be the following.

`4 * STDDEV50 / AVGC50`

Getting the value for the previous bar would involve adding back in the offset parameters.

`4 * STDDEV50.1 / AVGC50.1`

An exponential Bollinger BandWidth 10, 1.5 from 3 bars ago could be written as follows.

`3 * STDDEV10.3 / XAVGC10.3`

If you want the value given as a percentage with 0 at the bottom and 100 at the top instead of having 0 at the bottom and 1 at the top, then you would multiply the base formula by 100. So you would use the following for the current front weighted Bollinger Bandwidth 21, 2.5 if you wanted a percentage.

`500 * STDDEV21 / FAVGC21`  