BBANDS
Summary
Bollinger Bands: a moving-average middle band with upper and lower bands offset by a multiple of the standard deviation. Used to gauge relative price volatility.
Formula
middle = MA(inReal, period); sd = stddev(inReal, period); upper = middle + nbDevUp*sd; lower = middle - nbDevDn*sd
Notes
- The standard deviation uses the population form (dividing by the period), not the sample form.
- The standard deviation is always computed with a simple moving average regardless of the selected MA type.
Inputs
inReal— Input data series
Outputs
outRealUpperBand— Middle band plus nbDevUp standard deviationsoutRealMiddleBand— The moving averageoutRealLowerBand— Middle band minus nbDevDn standard deviations
Parameters
optInTimePeriod— Periods for the MA and standard deviationoptInNbDevUp— Standard-deviation multiplier for the upper bandoptInNbDevDn— Standard-deviation multiplier for the lower bandoptInMAType— Moving-average type for the middle band
Implementation
TA-Lib Definition: bbands.c · bbands.yaml
| Native | File |
|---|---|
| C | ta_BBANDS.c |
| Rust | bbands.rs |
| Java | Core.java |
TA-Lib is also available for Python, R and more using a wrapper.
Aliases
Bollinger Bands
See Also
References
- John A. Bollinger, Bollinger on Bollinger Bands, McGraw-Hill Trade (ISBN 0071373683)