What Bollinger Bands Tell You
Bollinger Bands are a volatility envelope around a moving average. The bands widen when volatility increases and contract when it decreases. For a developer building trading systems, they provide three actionable data points: dynamic support (lower band), dynamic resistance (upper band), and a volatility measure (bandwidth).
The Math (So You Know What the API Computes)
- Middle Band = 20-period Simple Moving Average (SMA)
- Upper Band = Middle Band + (2 x 20-period Standard Deviation)
- Lower Band = Middle Band - (2 x 20-period Standard Deviation)
- Bandwidth = (Upper - Lower) / Middle
- %B = (Price - Lower) / (Upper - Lower)
You do not need to compute any of this yourself. The TickAtlas API returns all five values pre-calculated.
API Response
// GET /v1/indicators?symbol=EURUSD&timeframe=H1
{
"success": true,
"data": {
"symbol": "EURUSD",
"timeframe": "H1",
"ohlcv": {
"close": 1.0835
},
"indicators": {
"BB_upper": 1.0892,
"BB_middle": 1.0856,
"BB_lower": 1.0820,
"BB_width": 0.0066
},
"updated_at": 1787229614
}
} Strategy 1: Bollinger Bounce (Mean Reversion)
Price tends to revert to the middle band. When price touches the lower band, it often bounces back. Combine with RSI for confirmation.
import requests
API_KEY = "your_api_key_here"
BASE_URL = "https://tickatlas.com/v1"
def bollinger_bounce(symbol: str) -> str:
resp = requests.get(f"{BASE_URL}/indicators", params={
"symbol": symbol,
"timeframe": "H1",
}, headers={"X-API-Key": API_KEY})
data = resp.json()["data"]
price = data["ohlcv"]["close"]
ind = data["indicators"]
rsi = ind["RSI_14"]
# Buy: price at/below lower band + RSI confirms oversold
if price <= ind["BB_lower"] * 1.002 and rsi < 35:
return f"BUY {symbol} — bouncing off lower BB ({ind['BB_lower']:.5f}), RSI {rsi:.1f}"
# Sell: price at/above upper band + RSI confirms overbought
if price >= ind["BB_upper"] * 0.998 and rsi > 65:
return f"SELL {symbol} — rejected at upper BB ({ind['BB_upper']:.5f}), RSI {rsi:.1f}"
return "HOLD" Strategy 2: Bollinger Squeeze (Breakout)
When bandwidth contracts to historically low levels, a big move is coming. The squeeze does not tell you the direction — but a breakout above the upper band is bullish, and below the lower band is bearish.
def bollinger_squeeze(symbol: str) -> str:
resp = requests.get(f"{BASE_URL}/indicators", params={
"symbol": symbol,
"timeframe": "H4",
}, headers={"X-API-Key": API_KEY})
data = resp.json()["data"]
price = data["ohlcv"]["close"]
ind = data["indicators"]
adx = ind["ADX"]
# Detect squeeze: low bandwidth + low ADX
if ind["BB_width"] < 0.003 and adx < 20:
return f"SQUEEZE {symbol} — bandwidth {ind['BB_width']:.4f}, ADX {adx:.1f}. Breakout imminent."
# Breakout confirmation
if ind["BB_width"] > 0.005 and price > ind["BB_upper"]:
return f"BREAKOUT UP {symbol} — price above upper BB after squeeze"
if ind["BB_width"] > 0.005 and price < ind["BB_lower"]:
return f"BREAKOUT DOWN {symbol} — price below lower BB after squeeze"
return "HOLD" Strategy 3: Bollinger Band Walk (Trend Following)
In strong trends, price "walks" along the upper or lower band for extended periods. Instead of fading the band touch, you ride it.
def bollinger_walk(symbol: str) -> str:
resp = requests.get(f"{BASE_URL}/indicators", params={
"symbol": symbol,
"timeframe": "H1",
}, headers={"X-API-Key": API_KEY})
data = resp.json()["data"]
price = data["ohlcv"]["close"]
ind = data["indicators"]
adx = ind["ADX"]
macd_hist = ind["MACD_hist"]
# Strong uptrend: price near upper band + ADX strong + MACD bullish
if adx > 25 and price > ind["BB_middle"] and macd_hist > 0:
if price > ind["BB_upper"] * 0.998:
return f"TREND BUY {symbol} — walking upper band, ADX {adx:.1f}"
# Strong downtrend: price near lower band + ADX strong + MACD bearish
if adx > 25 and price < ind["BB_middle"] and macd_hist < 0:
if price < ind["BB_lower"] * 1.002:
return f"TREND SELL {symbol} — walking lower band, ADX {adx:.1f}"
return "HOLD" Key Developer Considerations
Bandwidth is Your Volatility Metric
Track bandwidth over time. A declining bandwidth for 20+ candles signals an impending volatility expansion. Use this to prepare your strategy.
Always Combine with a Trend Filter
Use ADX to determine which Bollinger strategy to apply: mean reversion when ADX < 20, trend following when ADX > 25.
Multi-Timeframe Confirmation
A Bollinger squeeze on H4 is more significant than on M15. Check multiple timeframes before acting on a squeeze signal.
Further Reading
Run this against live data.
Every account starts pay-as-you-go with $2.50 of credit and no card. Paste the key into the samples above and the requests work unchanged.