Bollinger Bands
By LuxAlgoApr 13, 2020
Bollinger Bands is an indicator on Vela, our next-generation charting platform, written in Pine Script®.
Bollinger Bands wrap price in a self-adjusting envelope: a 20-period simple moving average basis with bands 2 standard deviations away, stretching as prices scatter and pulling in as they settle, so high and low are judged against current volatility. The build implements John Bollinger's classic 20/2.0 construction: the Basis, the upper and lower bands, and a shaded fill between them.
How to Trade the Bollinger Bands?
- Tag of an outer band: price is statistically stretched versus its recent average, a relative high or low, not an automatic signal.
- Pullback to the Basis: in trends the middle band is a drifting mean where pullbacks are evaluated for continuation.
- Narrow bands: tight bands show a market winding up; major moves often launch from the tightest stretches of the envelope.
- Close outside a band: the source is closing outside the bands entirely, the strongest stretch.
A band touch is a data point, not an instruction: closes beyond a band are routine in trends, so direction should come from structure or momentum. Alert conditions Cross Above Upper Band and Cross Below Lower Band fire when the close crosses an outer band.
Bollinger Bands Settings
- Length (default 20): the window for the Basis SMA and the standard deviation. Shorter hugs price and multiplies band tags, longer builds a smoother envelope.
- Source (default close): the price series the bands are calculated on.
- Multiplier (default 2.0): standard deviations between Basis and bands. Lower gives frequent touches, higher isolates rarer, more significant excursions.
- Basis / Bands / Fill (Style): the colors of the middle band, the outer bands, and the shaded area between them.
Frequently Asked Questions
Free to use
Run it on Vela. Go further with a paid plan.
- Up to 500 Custom Alerts, with webhook automation
- Up to 10× the chart history of Free
- Orderflow lookback up to full history
- More Quant usage to customize it, plus extra usage when you need it
- Futures data alongside crypto, stocks, forex and commodities
Related indicators
Run it on Vela. Make it yours with Quant.
Open this indicator free on Vela, our next-generation charting platform. Then ask Quant, our coding agent built into Vela, to retune it or turn it into a backtested strategy of your own.





