Bollinger %b

Bollinger %b is derived from John Bollinger's original Bollinger Bands® indicator. Bollinger %b describes where the most recent close price falls within the range created by the Upper and Lower Bollinger Bands or the degree to which the most recent close price falls outside the range created by the Upper and Lower Bollinger Bands.

Custom PCF Formula
(Cz - tAVGCx.z) / 2 / d / STDDEVx.z + .5
x=Period, d=StdDev, z=Offset, t=AverageType

Where x is the period which must be an integer.

Where d is the width of the Bollinger Bands in standard deviations.

Where z is the offset. An offset of 1 is 1 bar ago.

Where t is the average type. Leave blank for simple, X for exponential, F for front weighted, and H for Hull.


An indicator formula for a Bollinger Bands %B with a Period of 50 set to 2.00 Std Dev using an Average Type of Simple can be written as follows for the current bar.

(C0 - AVGC50.0) / 2 / 2 / STDDEV50.0 + .5

But we can leave off the offset parameters since these parameters would just be zero for the current bar.

(C - AVGC50) / 2 / 2 / STDDEV50 + .5

Replicating the value when the Average Type is set to Exponential instead would involve changing the AVGC50 to XAVGC50.

(C - XAVGC50) / 2 / 2 / STDDEV50 + .5

Getting the value for the previous bar instead of the current bar would require adding back in the offset parameters.

(C1 - XAVGC50.1) / 2 / 2 / STDDEV50.1 + .5

Read more about Bollinger %b at

Bollinger Bands® are the registered trademark of John Bollinger, who developed them.