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:
- Basis (blue): a moving average of the source over Length bars. By default it is a 20-bar SMA of the close.
- Upper (red): basis plus StdDev × the standard deviation of the source over the same bars.
- Lower (green): basis minus the same distance.
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
- Open a chart, for example NSE:RELIANCE on the 1D interval.
- Click Indicators, type "bb" and click Bollinger Bands.
- Hover the legend line "BB 20 SMA close 2" and click the gear for Settings.
- On Inputs, set Length (20), Basis MA Type (SMA, EMA, SMMA (RMA), WMA or VWMA), Source (Close), StdDev (2) and Offset (0).
- On Style, recolour or hide the Basis, Upper and Lower plots, or turn off the Background fill.
- 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
- Squeeze: when the bands are much narrower than usual, volatility is low. Low volatility tends to be followed by a larger move, but the bands do not tell you its direction.
- Walking the band: in a strong trend, closes can hug the upper band for many bars. A touch of the upper band in an uptrend is often a sign of strength, not a sell signal.
- Return to the basis: in a range, price that stretches to an outer band often drifts back towards the basis.
- Combine with momentum: a lower-band touch while RSI shows a higher low is read differently from a touch while RSI is making new lows.
These describe how traders read the indicator. They are not trading advice.
Related band tools in the library
| Built-in | What it shows |
|---|---|
| Bollinger Bands %b | Where the close sits in the bands: 1 at the upper band, 0 at the lower, 0.5 at the basis |
| Bollinger BandWidth | Band width relative to the basis, with Highest Expansion and Lowest Contraction lines over 125 bars |
| BBTrend | A histogram comparing short (20) and long (50) bands; above zero leans up, below zero leans down |
| Bollinger Bars | Redraws each candle as a coloured body with a separate high-low bar behind it |
| Keltner channels | ATR-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
- Open the Script Editor, paste the code and save it.
- In Indicators, open My scripts and click Bollinger squeeze.
- In the legend's More menu choose Add alert on BB squeeze…, then pick "Squeeze ended".
- 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:
- Bollinger Bands strategy: when the close crosses back above the lower band, it places a buy stop at the lower band. When the close crosses back under the upper band, it places a sell stop at the upper band. Length is 20 and the multiplier 2.0.
- Bollinger Bands strategy directed: the same rules, plus a Strategy Direction input (−1 short only, 0 both, 1 long only).
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.