SuperCharting
Sign in Get started Account Open charts

Learn / Indicators

Bollinger Bands: settings, squeezes and band tools in SuperCharting

How to use Bollinger Bands in SuperCharting: length, StdDev and basis MA type, %b and BandWidth, a squeeze alert script and the Bollinger Bands strategy.

Bollinger Bands draw a moving average with a band above and below it, set a number of standard deviations away. The bands widen when prices swing hard and narrow when the market goes quiet. In SuperCharting you add them from Indicators by searching "bb" or "bollinger". They arrive with TradingView's defaults (20 bars, 2 standard deviations) and come with a family of related tools: %b, BandWidth, BBTrend, Bollinger Bars and two strategies.

How the bands are built

The built-in Bollinger Bands script plots three lines on the price chart, with a shaded fill between the outer two:

With a 2.0 multiplier, most closes stay inside the bands. Note that "most" is a rule of thumb, not a promise, because price returns do not follow a perfect bell curve. A close outside the bands means price has moved unusually far from its recent average. It does not mean the move must reverse.

How to add and set up Bollinger Bands in SuperCharting

  1. Open a chart, for example NSE:RELIANCE on the 1D interval.
  2. Click Indicators, type "bb" and click Bollinger Bands.
  3. Hover the legend line "BB 20 SMA close 2" and click the gear for Settings.
  4. On Inputs, set Length (20), Basis MA Type (SMA, EMA, SMMA (RMA), WMA or VWMA), Source (Close), StdDev (2) and Offset (0).
  5. On Style, recolour or hide the Basis, Upper and Lower plots, or turn off the Background fill.
  6. Click Ok. The settings stay with the layout.

Many intraday traders on charts such as BTCUSD 15m keep 20 and 2.0. Some widen to 2.5 for fewer touches, and some use a 10-bar length with 1.5 for scalping. There is no correct value, so test what you change.

Reading the bands

These describe how traders read the indicator. They are not trading advice.

Built-inWhat it shows
Bollinger Bands %bWhere the close sits in the bands: 1 at the upper band, 0 at the lower, 0.5 at the basis
Bollinger BandWidthBand width relative to the basis, with Highest Expansion and Lowest Contraction lines over 125 bars
BBTrendA histogram comparing short (20) and long (50) bands; above zero leans up, below zero leans down
Bollinger BarsRedraws each candle as a coloured body with a separate high-low bar behind it
Keltner channelsATR-based bands around an EMA, useful next to Bollinger Bands for squeezes

RSI's smoothing menu also has an SMA + Bollinger Bands option. It draws bands around the moving average of RSI instead of around price.

A squeeze alert script

The built-in Bollinger Bands script defines no alerts, and a price alert can only compare price with a fixed number. A short script lets you get an alert when a squeeze starts or ends. This one calls it a squeeze when both Bollinger Bands sit inside a Keltner channel of the same length, and shades those bars:

//@version=6
indicator("Bollinger squeeze", "BB squeeze", overlay = true)
length = input.int(20, "Length", minval = 1)
mult   = input.float(2.0, "StdDev", minval = 0.1)
kcMult = input.float(1.5, "Keltner multiplier", minval = 0.1)
[basis, upper, lower] = ta.bb(close, length, mult)
kcMid = ta.ema(close, length)
kcRange = ta.atr(length) * kcMult
squeeze = upper < kcMid + kcRange and lower > kcMid - kcRange
plot(basis, "Basis", color.blue)
plot(upper, "Upper", color.red)
plot(lower, "Lower", color.green)
bgcolor(squeeze ? color.new(color.orange, 85) : na, title = "Squeeze")
alertcondition(squeeze and not squeeze[1], "Squeeze started", "Bollinger Bands moved inside the Keltner channel")
alertcondition(not squeeze and squeeze[1], "Squeeze ended", "Bollinger Bands moved back outside the Keltner channel")

Steps to use it

  1. Open the Script Editor, paste the code and save it.
  2. In Indicators, open My scripts and click Bollinger squeeze.
  3. In the legend's More menu choose Add alert on BB squeeze…, then pick "Squeeze ended".
  4. Set Trigger to Once per bar close and choose an Expiration.

Alerts on a script use its default inputs, so edit the numbers in the code itself (for example kcMult to 2.0) rather than in the Settings dialog. The price alerts guide explains the rest of the alert dialog.

Testing band strategies

The Strategies chip has two built-ins on these bands:

Add one to a chart such as EURUSD on 1h and open the Strategy Tester. Set realistic Commission and Slippage on the Properties tab first. Past results do not guarantee future results.

Frequently asked questions

Should the basis be an SMA or an EMA?

The classic definition uses an SMA, which is the default. An EMA basis reacts faster to recent prices. Change it with Basis MA Type.

Why are the bands so wide on gold?

The bands follow the symbol's own volatility. XAUUSD often moves more in an hour than a large-cap stock, so its bands sit further apart in price terms. %b and BandWidth make different symbols easier to compare.

Can I plot Bollinger Bands on RSI?

Yes. Add Bollinger Bands, open Settings and set Source to "Relative strength index: RSI". The bands then follow RSI; see indicators on indicators. Or use RSI's own SMA + Bollinger Bands smoothing.

Can I use Bollinger Bands on several charts at once?

Yes. Add them to each chart, or save them in an indicator template and apply it to any chart in one click.

Try it on a live chart

SuperCharting runs in your browser: charts, Pine-compatible scripts, the Strategy Tester, alerts and the screener, with Indian and global markets.

Create a free account More guides