Tool
Bands
market.bands
Inputs
No typed inputs.
Outputs
A three-line bundle — upper band, middle line, and lower band — that you can tap individually. Price near a band edge flags stretched conditions; the gap between the bands shows how volatile the market is.
Bands draws a channel around price: a middle line plus an upper and a lower band that flex with volatility. Price riding the edges signals stretched conditions, and the band width itself tells you whether the market is calm or expanding. The mode picks how the bands are built.
How it works
A centre line is computed over the period (default 20 bars) and the upper/lower bands are placed a distance away from it. How that distance is set depends on the mode: standard deviation (Bollinger), an ATR multiple around an EMA (Keltner), or the highest-high and lowest-low of the lookback (Donchian).
Modes
Bands sit a number of standard deviations (set by std_mult) above and below a simple moving average, so they widen when price gets volatile and pinch in when it calms.
When to use: The default choice for mean-reversion and squeeze setups, where you care about how stretched price is relative to its own recent noise.
Bands sit an ATR multiple (set by atr_mult over atr_period) above and below an EMA, so the width tracks true range rather than statistical spread.
When to use: When you want a smoother, less spiky channel than Bollinger and prefer volatility measured by ATR — common for trend and breakout filters.
The upper band is the highest high and the lower band is the lowest low over the lookback, so the edges form a flat, stepped channel that only moves when a new extreme prints.
When to use: Classic breakout trading — buy a push above the recent highest high, sell a break below the recent lowest low.
Configuration
How the bands are built: bollinger (standard-deviation bands around an SMA), keltner (ATR bands around an EMA), or donchian (highest-high / lowest-low channel).
Lookback for the centre line and channel: bars in the moving average for Bollinger/Keltner, or the high/low lookback window for Donchian. 20 is the common default.
Standard-deviation multiplier for the band width in bollinger mode only (ignored by keltner and donchian). 2.0 is the classic setting; larger pushes the bands wider so fewer touches register.
Std-dev degrees-of-freedom for the Bollinger dispersion: 0 = population (the classic charting convention), 1 = sample. Bollinger mode only.
ATR multiplier for the band width in keltner mode only (ignored by bollinger and donchian). Larger widens the channel; 2.0 is a common starting point.
Lookback for the ATR used to size the bands in keltner mode only (ignored by bollinger and donchian). Larger = smoother band width; 10 is a typical default.
Connects to
Examples
- Mean reversion: feed the upper and lower bands into calc.band_reentry to fire a long when price snaps back inside the lower band.
- Breakout filter: in donchian mode, gate entries to only the bars where price closes beyond the channel edge.
Common mistakes
- Setting std_mult while in keltner or donchian mode and expecting it to change the width — std_mult only applies to bollinger; keltner uses atr_mult / atr_period.
- Treating a band touch as an automatic reversal — in a strong trend price can ride the upper band for many bars without turning.