How it is calculated
The middle band is the simple moving average of the source over the length. The upper and lower bands are the middle plus and minus mult times the population standard deviation of the same prices (dividing by n, not n minus 1). The first value comes once the length is filled. As TA-Lib BBANDS, after Bollinger 1983.
Reference: TA-Lib BBANDS (Bollinger 1983)
How to read it
A close outside a band shows a strong move, not by itself a reversal; in a trend price can ride along the upper or lower band. Narrow bands (a squeeze) often come before a larger move without telling its direction. The middle band serves as a trend reference.
In a strategy
Mean reversion back toward the middle after a close below the lower band, or a breakout entry when price closes above ctx.ind("bb", length=20, mult=2.0).upper after a squeeze.
Inputs
| Input | Type | Default | Range or choices |
|---|---|---|---|
Lengthlength | Whole number | 20 | min 2, max 5000 |
Multipliermult | Number | 2 | min 0.1, max 10 |
Sourcesource | Price | "close" | close, open, high, low, hl2, hlc3, ohlc4, hlcc4 |
What it draws
| Line | Drawn as |
|---|---|
| Upper | Line |
| Basis | Line |
| Lower | Line |
Used in
No strategy template reads it yet.