Bollinger Bands
Quick Reference
| Property | Value |
|---|---|
| Dimension | technical |
| Category | technical |
| Version | v0.9.0 (Beta) |
| Output Column | bollinger_pct_b |
Bollinger Band %B: (price - lower) / (upper - lower) - normalized price position within volatility bands
Formula
(price - (rolling_mean(price, window) - (rolling_std(price, window) * k))) / ((rolling_mean(price, window) + (rolling_std(price, window) * k)) - (rolling_mean(price, window) - (rolling_std(price, window) * k)))
CDM Inputs
| Column | CDM Table | Description |
|---|---|---|
price | cdm_* | CDM source table |
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
window | integer [2, 500] | 20 | Window for moving average and standard deviation |
k | float [1.0, 5.0] | 2.0 | Number of standard deviations for band width |
Output
Column: bollinger_pct_b
%B indicator: 0=at lower band, 1=at upper band, <0 or >1=band breakout
Market Intuition & Trading Rationale
Bollinger Bands %B normalizes price position within volatility envelopes: (price - lower) / (upper - lower), where lower = SMA - k×σ and upper = SMA + k×σ. %B = 0 means price is at the lower band; %B = 1 means at the upper band; %B > 1 means price has broken above the upper band (overbought breakout); %B < 0 means broken below the lower band (oversold breakdown).
%B is more useful than raw band values because it's normalized — it works across instruments and time periods without recalibration. The default parameters (20-period window, k=2) create bands that contain approximately 95% of price observations under normality. The window controls responsiveness (shorter = faster, noisier) and k controls band width (larger k = wider bands, fewer touches).
In range-bound markets, price tends to oscillate between %B = 0 and %B = 1 — buy at the lower band, sell at the upper. In trending markets, price can "ride the band" — %B stays above 0.8 in uptrends or below 0.2 in downtrends for extended periods. The %B value distinguishes these two regimes in real time.
Usage Cases
- Mean reversion in ranges: Buy when %B < 0 (below lower band), sell when %B > 1 (above upper band). Only do this in confirmed range-bound markets — in trends, band touches are continuation signals, not reversal signals.
- Breakout confirmation: %B sustained above 1.0 for multiple bars after being range-bound → genuine bullish breakout. %B briefly crossing 1.0 and immediately reverting → false breakout (bull trap).
- The Squeeze: When band width (upper - lower) reaches a multi-period minimum, the market is "squeezing" — a period of exceptionally low volatility that typically precedes a large directional move. %B's behavior after the squeeze resolves indicates direction.
YAML Definition
name: bollinger_bands
description: 'Bollinger Band %B: (price - lower) / (upper - lower) - normalized price
position within volatility bands'
category: technical
version: v0.9.0 (Beta)
dimension: technical
status: Pre-release
required_inputs:
- price
output_column: bollinger_pct_b
output_description: '%B indicator: 0=at lower band, 1=at upper band, <0 or >1=band
breakout'
parameters:
window:
type: integer
description: Window for moving average and standard deviation
required: false
default: 20
constraints:
min: 2
max: 500
k:
type: float
description: Number of standard deviations for band width
required: false
default: 2.0
constraints:
min: 1.0
max: 5.0
formula: (price - (rolling_mean(price, window) - (rolling_std(price, window) * k)))
/ ((rolling_mean(price, window) + (rolling_std(price, window) * k)) - (rolling_mean(price,
window) - (rolling_std(price, window) * k)))