Skip to content

Superseded (2026-05-25) — this operator is a Layer-1 transform, not a Layer-0 atomic input. Merged into compute_bollinger_v1. Kept for history.

What (One-liner)

Bollinger Bands upper/middle/lower, 20-day SMA + 2σ envelope.

How to use

python
from services.algo.technical import compute_bollinger
upper, middle, lower = compute_bollinger(prices, period=20, num_std=2.0)

Core formulas

middle = prices.rolling(20).mean()
std = prices.rolling(20).std(ddof=0)
upper = middle + 2×std
lower = middle - 2×std

Assumptions & applicability

Assumptions: Bollinger 20/2σ defaults + ddof=0 + pandas-ta equivalent.

Applicability: mean reversion signals, breakout identification, volatility envelope.

Not applicable: n<20, trending (bands hug price).

Known limitations

  1. ddof selection sensitive
  2. 20/2σ hardcoded
  3. pandas-ta dependency

References

Bollinger (2001) original work + Murphy (1999) textbook.

Golden Test

tests/golden/fixtures/tier1/compute_bollinger/, 1e-10, 2026-04-20 passing.

Changelog

  • 1.0.0 (2026-04-20) — BUG-GOLDEN-002 fix + first Active

Verifiable intelligence for the decisions that demand scrutiny.