# Bollinger BandWidth

`D07-F04-A06` · Technical Indicators → Volatility and Channels · archetype `series-transform` · difficulty 3/5 · verification **verified**

Full page: https://docs.thefintechbuilder.com/technical-indicators/volatility-and-channels/bollinger-bandwidth/
Agent skill: `npx skills add IslamBaraka90/Fintech-Algorithms-Library` — https://docs.thefintechbuilder.com/guides/agent-skill/

## Install and import

```bash
npm install fintech-algorithms
```

```ts
import { bollingerBandwidth } from "fintech-algorithms/technical-indicators/volatility-and-channels/bollinger-bandwidth";
```

## Signature

```ts
bollingerBandwidth(close, p, multiplier)
```

The width of a Bollinger channel relative to its middle band. Low readings mark contraction, which historically precedes expansion — the quantity behind every 'squeeze' screen.

## Parameters

| Name | Type | Required | Notes |
| --- | --- | --- | --- |
| `close` | `number[]` | yes | Per-bar closing prices, chronological. |
| `p` | `number` | yes | Lookback for the average and the standard deviation. · min: 1, integer: true |
| `multiplier` | `number` | yes | Number of standard deviations to each band. · min: 0 |

## Returns

`Record<string, (number | null)[]>` · length same-as-input

Parallel series: `middle`, `stddev`, `upper`, `lower` and `bandwidth`.

## Warm-up

The first `p − 1` positions are `null`.

## Errors

- When p < 1, is not an integer, or multiplier is negative — throws RangeError

## Complexity

Time `O(n × p)`, space `O(n)`.

## Worked example

Captured by running this function on the input its own test provides. Real output of real code — but not asserted against a published figure.

### Input

`close`:

```json
[100, 100.40234656, 100.79879348, 101.18354586, 101.55101638, 101.89592451]
```

Showing 6 of 240 elements.

`p`:

```json
20
```

`multiplier`:

```json
2
```

### Call

```ts
bollingerBandwidth(close, p, multiplier)
```

### Returns

object with 5 fields: middle, stddev, upper, lower, bandwidth

```json
{
  "middle": [null, null, null, null, null, null],
  "stddev": [null, null, null, null, null, null],
  "upper": [null, null, null, null, null, null],
  "lower": [null, null, null, null, null, null],
  "bandwidth": [null, null, null, null, null, null]
}
```

## Other exports

`bollingerBands`. Every module additionally exports `run` as an alias of its primary
function, and a `meta` object carrying its catalog id, domain, family, shape and article URL.

## Verification and provenance

Tier: **verified** (via scenario-fixture).

The worked example below is the figure published in this algorithm's article, replayed and asserted by the test suite on every build. The arithmetic cannot drift without the build failing.

Both tiers guarantee the signature. Full explanation: https://docs.thefintechbuilder.com/guides/verification/

Generated from the docs.json payload shipped inside fintech-algorithms@0.13.1.
The signature and parameter list are checked against the compiled implementation at build time,
so a description that contradicts the code fails the build rather than reaching this file.

## Links

- Article (how it works, step by step): https://thefintechbuilder.com/technical-indicators/volatility-and-channels/bollinger-bandwidth/
- Implementation source: https://github.com/IslamBaraka90/Fintech-Algorithms-Library/blob/main/src/technical-indicators/volatility-and-channels/bollinger-bandwidth/impl.ts
- Package on npm: https://www.npmjs.com/package/fintech-algorithms
- Domain index for agents: https://docs.thefintechbuilder.com/technical-indicators/llms.txt
