Bollinger Bands
Category: Trend · Updated November 2026
The TAAPI.IO Bollinger Bands API returns the upper, middle and lower bands as JSON for crypto pairs and US stocks. Send an exchange, symbol and timeframe to get real-time or historical values, with no candles to download and no calculations to maintain.
What one request returns
- The three bands: the middle band (
valueMiddleBand), a 20-period moving average, and the upper and lower bands (valueUpperBand,valueLowerBand), two standard deviations either side of it. - A series, with
results: one set of bands per candle, oldest first, to measure how wide the bands are compared with their recent history. - Bands and price together, with
/bulk: add thepriceindicator to compare the latest close with the bands in the same request.
So one call answers two questions: is price stretched, and is volatility about to change?
Example: a squeeze, then a walk down the lower band, 8 to 14 November 2026
Request: GET /indicator/bbands for SOLUSDT on 4-hour Binance candles, with results=50 and backtrack=1, so the last 50 closed candles. Sent at 21:59 UTC on 14 November with the default settings of 20 and 2. Three of the 50 candles are below, with closes from candles.
| Candle | SOL close | Upper | Middle | Lower | Width | Reading |
|---|---|---|---|---|---|---|
| 8 Nov 16:00 | 89.60 | 90.63 | 89.88 | 89.13 | 1.66% | Squeeze: the narrowest bands in six weeks |
| 8 Nov 20:00 | 86.54 | 91.32 | 89.70 | 88.07 | 3.62% | Close 1.7% below the lower band |
| 14 Nov 16:00 | 72.24 | 87.04 | 79.84 | 72.64 | 18.04% | Still closing below the lower band |
How to interpret this: For 20 candles, from 5 November at 12:00 to 8 November at 16:00, SOL closed between 89.32 and 90.75. With so little movement, the standard deviation shrank and the bands closed to 1.66% of price, the narrowest since the end of September. Narrow bands mean low volatility, and low volatility rarely lasts. The next candle fell 3.4% and closed 1.7% below the lower band, and the squeeze turned into a trend. Over the next 36 candles SOL fell to 72.24, 16.5% below the breakout close. It closed below the lower band 11 times and never once closed above the middle band, while the bands widened to 18.04%. This is what John Bollinger calls walking the band. For a mean-reversion trader, every close below the lower band looked like a buy. The first one, at 86.54, only reached the middle band on 11 November because the middle band had fallen to 85.59 to meet it, so it closed for a 1.1% loss. The next one, at 78.47 on 13 November, was 7.9% down by 14 November. A breakout trader reading the same bands sold the first close below the lower band and has been on the right side since.
Values are from the production API on 14 November 2026, using closed 4-hour candles from 29 September. One squeeze is an illustration, not a backtest, and nothing here is financial advice.
| Spec | Value |
|---|---|
| Endpoint | GET https://v2.taapi.io/indicator/bbands |
| Outputs | Upper band, middle band, lower band, timestamp |
| Default settings | Period 20, 2 standard deviations |
| Markets | Binance, Binance Futures, Bybit, Gate.io, Kraken and US stocks |
| Timeframes | 1m to 1w |
| Delivery | REST, bulk and WebSocket |
Get Bollinger Bands with one API call
This request returns Bollinger Bands for BTCUSDT on 1-hour Binance candles. Add your API key to run it here.
curl -G https://v2.taapi.io/indicator/bbands \ -H "Authorization: Bearer YOUR_API_KEY" \ --data-urlencode "exchange=binance" \ --data-urlencode "symbol=BTCUSDT" \ --data-urlencode "timeframe=1h"
import requests
resp = requests.get(
'https://v2.taapi.io/indicator/bbands',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
params={'exchange': 'binance', 'symbol': 'BTCUSDT', 'timeframe': '1h'},
)
print(resp.json())const params = new URLSearchParams({"exchange": "binance", "symbol": "BTCUSDT", "timeframe": "1h"});
const res = await fetch(`https://v2.taapi.io/indicator/bbands?${params}`, {
headers: { Authorization: 'Bearer YOUR_API_KEY' },
});
console.log(await res.json());Bollinger Bands API response
This response came from the live API on 9 November 2026.
{
"valueUpperBand": [76349.5737352088],
"valueMiddleBand": [74985.87349999997],
"valueLowerBand": [73622.17326479114],
"timestamp": [1794218400]
}| Field | Type | Description |
|---|---|---|
valueUpperBand | number[] | Upper band |
valueMiddleBand | number[] | Middle band |
valueLowerBand | number[] | Lower band |
timestamp | integer[] | Unix time of each candle, in seconds |
Bollinger Bands API parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
exchange | string | Yes | — | binance, binancefutures, bybit, gateio, kraken or stocks |
symbol | string | Yes | — | Pair or ticker, e.g. BTCUSDT or AAPL |
timeframe | string | Yes | — | 1m 5m 15m 1h 4h 1d 1w |
period | integer | No | 20 | Number of closes in the moving average and the standard deviation |
stddev | number | No | 2 | Distance of the outer bands from the middle band, in standard deviations |
results | integer | No | 1 | Number of values to return, or max |
backtrack | integer | No | 0 | Candles to skip from the most recent |
What are Bollinger Bands?
Bollinger Bands, developed by John Bollinger in the 1980s, place bands a set number of standard deviations above and below a moving average. Because the width follows volatility, the bands expand in fast markets and contract in quiet ones.
Bollinger Bands formula
| Output | Calculation |
|---|---|
| Middle band | Simple moving average of the last 20 closes |
| Standard deviation | Standard deviation of the same 20 closes, divided by 20 (not 19) |
| Upper band | Middle band + 2 × standard deviation |
| Lower band | Middle band − 2 × standard deviation |
In the example, the 20 closes up to 8 November 16:00 average 89.88 with a standard deviation of 0.37. So the bands are 89.88 ± 0.75: 89.13 and 90.63.
How to read Bollinger Bands in your code
| Signal | Meaning | Condition |
|---|---|---|
| Upper band tag | Price is high relative to its recent range | Close at or above valueUpperBand |
| Lower band tag | Price is low relative to its recent range | Close at or below valueLowerBand |
| Squeeze | Volatility has contracted | Band width at its lowest for many candles |
| Breakout | Volatility is expanding | First close outside a band after a squeeze |
| Band walk | Strong trend | Repeated closes at or outside one band, none past the middle band |
Limitations: A touch of a band is not a reversal signal. In strong trends price can walk along a band for many candles, as in the example above. Nothing on this page is financial advice.
Bollinger %B and Bandwidth
John Bollinger defined two measures you can calculate from the three values this endpoint returns.
| Measure | Calculation |
|---|---|
| %B | (close − lower band) ÷ (upper band − lower band) |
| Bandwidth | (upper band − lower band) ÷ middle band × 100 |
%B above 1 means the close is over the upper band, and below 0 means it is under the lower band. The breakout candle in the example had a %B of −0.47. If you only need the width, the Bollinger Bands Width endpoint returns it directly.
Mean reversion or breakout?
The same bands support two opposite approaches, and the market state decides which one applies. In a range, a move to an outer band is often followed by a return to the middle. After a squeeze, a close outside a band can be the start of a larger move, and price may then walk along that band, as SOL did in November.
Check the bands' width before you buy a lower-band close. A close outside a band almost always widens the bands by itself: on SOL's 4-hour chart, 27 of the 28 closes below the lower band since October came with wider bands than the candle before. So a widening band doesn't tell a breakout from a bounce, but a squeeze just before does. A trend filter such as ADX, or a Squeeze Momentum reading, also helps tell the two apart.
Detect a Bollinger Band squeeze with Python
A squeeze is a period when the bands are unusually narrow. This calculates band width across the last 50 closed candles and checks whether the latest one is near the low of that range.
curl -G https://v2.taapi.io/indicator/bbands \ -H "Authorization: Bearer YOUR_API_KEY" \ --data-urlencode "exchange=binance" \ --data-urlencode "symbol=BTCUSDT" \ --data-urlencode "timeframe=1h" \ --data-urlencode "results=50" \ --data-urlencode "backtrack=1"
import requests
resp = requests.get(
'https://v2.taapi.io/indicator/bbands',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
params={'exchange': 'binance', 'symbol': 'BTCUSDT', 'timeframe': '1h', 'results': 50, 'backtrack': 1},
)
data = resp.json()
widths = [
(upper - lower) / middle * 100
for upper, middle, lower in zip(
data['valueUpperBand'], data['valueMiddleBand'], data['valueLowerBand']
)
]
if widths[-1] <= min(widths) * 1.05:
print(f'Squeeze: band width is {widths[-1]:.2f}%')
else:
print(f'No squeeze: band width is {widths[-1]:.2f}%')Detect a squeeze breakout with Python
The squeeze check above tells you the bands are narrow. A breakout trader waits for the next step: the first close outside a band right after the squeeze. This request returns 50 sets of bands and the last close in one /bulk call, and fits on the Basic plan because it uses one construct.
curl -X POST https://v2.taapi.io/bulk \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"constructs": [
{
"id": "sol_4h",
"exchange": "binance",
"symbol": "SOLUSDT",
"timeframe": "4h",
"indicators": [
{
"id": "bb",
"indicator": "bbands",
"results": 50,
"backtrack": 1
},
{
"id": "close",
"indicator": "price",
"backtrack": 1
}
]
}
]
}'import requests
payload = {
"constructs": [
{
"id": "sol_4h",
"exchange": "binance",
"symbol": "SOLUSDT",
"timeframe": "4h",
"indicators": [
{
"id": "bb",
"indicator": "bbands",
"results": 50,
"backtrack": 1
},
{
"id": "close",
"indicator": "price",
"backtrack": 1
}
]
}
]
}
resp = requests.post(
'https://v2.taapi.io/bulk',
headers={'Authorization': 'Bearer YOUR_API_KEY'},
json=payload,
)
data = resp.json()
bb = data['sol_4h']['bb']
close = data['sol_4h']['close']['value'][-1]
widths = [
(upper - lower) / middle * 100
for upper, middle, lower in zip(bb['valueUpperBand'], bb['valueMiddleBand'], bb['valueLowerBand'])
]
# A squeeze: the candle before this one had the narrowest bands of the last 49
squeeze = widths[-2] <= min(widths[:-1]) * 1.05
if squeeze and close < bb['valueLowerBand'][-1]:
print('Squeeze breakout down')
elif squeeze and close > bb['valueUpperBand'][-1]:
print('Squeeze breakout up')
else:
print(f'No squeeze breakout, band width {widths[-1]:.2f}%')The response at 21:59 UTC on 14 November, with each band shortened to its last two values. The candle before was 16.18% wide, far from the six-week low, so the script prints No squeeze breakout, band width 18.04%. With backtrack set to 36 for both indicators, the request ends at the 8 November 20:00 candle, and the same script prints Squeeze breakout down.
{
"sol_4h": {
"bb": {
"valueUpperBand": [86.92980171845332, 87.03847109568737],
"valueMiddleBand": [80.42400000000019, 79.83800000000019],
"valueLowerBand": [73.91819828154706, 72.63752890431302],
"timestamp": [1794657600, 1794672000]
},
"close": {
"value": [72.24],
"timestamp": [1794672000]
}
}
}Not every breakout follows through. In the six weeks before 14 November this rule fired twice on SOL. One was the November breakdown. The other was on 28 October at 08:00, when SOL closed at 102.75, just 0.02 above the upper band. That breakout failed: a day and a half later SOL closed at 95.64, below the lower band and 6.9% lower. Requiring the close to clear the band by a margin, or confirming with volume, filters out the weakest breakouts.
Get historical Bollinger Bands values
Add results to return a series for backtesting or charting. The last element is the most recent candle.
curl -G https://v2.taapi.io/indicator/bbands \ -H "Authorization: Bearer YOUR_API_KEY" \ --data-urlencode "exchange=binance" \ --data-urlencode "symbol=BTCUSDT" \ --data-urlencode "timeframe=1h" \ --data-urlencode "results=100"
Get Bollinger Bands for multiple symbols
Combine Bollinger Bands with other indicators in one request. Each exchange, symbol and timeframe combination is one construct: Basic allows 1 per request, Pro 3 and Expert 10.
curl -X POST https://v2.taapi.io/bulk \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"constructs": [
{
"id": "btc_1h",
"exchange": "binance",
"symbol": "BTCUSDT",
"timeframe": "1h",
"indicators": [
{
"id": "bbands",
"indicator": "bbands"
},
{
"id": "rsi",
"indicator": "rsi"
}
]
}
]
}'Stream Bollinger Bands in real time
Subscribe over WebSocket to receive new values every 5 seconds while the candle is forming. Streaming supports 1m, 5m, 15m and 1h, and uses interval where REST uses timeframe.
{
"type": "subscribe",
"id": "bbands",
"exchange": "binance",
"symbol": "BTCUSDT",
"interval": "1m",
"indicator": "bbands"
}Common Bollinger Bands settings
These are starting points, not recommendations. Test any setting on your own market and timeframe.
| Settings | Character | Typical use |
|---|---|---|
| 20, 2 | Standard | Default suggested by Bollinger |
| 10, 1.5 | Tighter, faster | Short-term charts |
| 50, 2.5 | Wider, slower | Longer-term charts |
Why Bollinger Bands values can differ between platforms
- Exchange data: The bands are built from the closes of the exchange you request.
- Open candle: The newest bands change with every update until the candle closes.
- Settings: Check that
periodandstddevmatch your chart. The defaults are 20 and 2. - Deviation method: TAAPI.IO divides by the number of closes (20), as Bollinger does. Tools that divide by 19 draw slightly wider bands.
Bollinger Bands API FAQ
What does the Bollinger Bands API return?
Four arrays: valueUpperBand, valueMiddleBand, valueLowerBand and a timestamp for each candle.
Is the latest Bollinger Bands value final?
No. The newest value belongs to the candle still forming and can change until it closes. Add backtrack=1 to read the last closed candle.
How do I detect a Bollinger Band squeeze?
Request results=50, calculate the width of each set of bands, and check whether the latest width is at or near the lowest of the series. See Detect a Bollinger Band squeeze with Python.
Is a close below the lower band a buy signal?
Not on its own. In a range it can be, but after a squeeze it is often the start of a trend, as in the example above, where SOL closed below the lower band 11 times in six days while it fell 16.5%.
Can I change the Bollinger Bands width?
Yes. Set stddev for the multiplier and period for the lookback. The defaults are 2 and 20.
Can I get Bollinger Bands for US stocks?
Yes. Use exchange=stocks with a ticker such as AAPL. US stocks are included on the Pro plan and above.
Related indicators
- Bollinger Bands Width: the band width, returned directly
- Keltner Channels: ATR-based bands, used with Bollinger Bands for the squeeze
- Squeeze Momentum: squeeze and breakout direction in one indicator
- Simple Moving Average: the middle band
- Average True Range: another volatility measure
Build with Bollinger Bands on Binance, Bybit or US stocks. Start for free or browse all 262 indicators.