Bollinger %B
All indicators

LibraryVolatility

Indicator

Bollinger %B

Where the price sits within the Bollinger Bands: 0 at the lower band, 1 at the upper band, 0.5 at the middle. Below 0 or above 1 the price is outside the bands.

VolatilityOwn pane3 inputs%B

How it is calculated

The price minus the lower band, divided by the upper band minus the lower band. The bands are the catalogue's Bollinger Bands with the same length, mult and source (SMA plus and minus mult population standard deviations). When every price in the window is the same the bands have no width and %B has no value. After Bollinger 2001.

Reference: Bollinger 2001, bands as TA-Lib BBANDS

How to read it

Above 1 the price is above the upper band, below 0 under the lower one. Readings that stay near 1 in an uptrend show strength rather than a top. Comparing %B highs with price highs can show a divergence: price makes a new high, %B does not.

In a strategy

A rule that does not depend on the price level: buy when ctx.ind("bbp", length=20) rises back above 0 after closing below it, or take profits when it reaches 1.

Inputs

InputTypeDefaultRange or choices
LengthlengthWhole number20min 2, max 5000
MultipliermultNumber2min 0.1, max 10
SourcesourcePrice"close"close, open, high, low, hl2, hlc3, ohlc4, hlcc4

What it draws

LineDrawn as
%BLine

Guide lines at 0, 1.

Used in

No strategy template reads it yet.

OrionQuant