About

Bollinger Bands are an average line with two bands around it. The bands widen when prices swing more.

In KAGAMI, it is called Bollinger Bands in the Indicators list.

  1. Click Indicators at the top of the chart.
  2. Type Bollinger Bands.
  3. Click it. The lines appear on the chart.

It is free for every account.

What you see on the chart

  • Three lines, drawn over the price bars. A bar, also called a candle, is one slice of time.
  • The orange middle line is the average price of the last 20 bars.
  • The blue upper and lower lines are the bands.
  • A light blue shade fills the space between the bands.
  • When prices swing a lot, the bands move apart. When prices are calm, they come close.
  • The lines do not start on the very first bar. With the first settings, they need 20 bars.
  • Its short name, BB, shows at the top left of the chart.

Opened KAGAMI from a link and see lines you did not add? They may be KAGAMI's own version. See KAGAMI's own version.

How traders often read it

  • Many traders read narrow bands as a calm market. Some call a very narrow stretch a "squeeze".
  • Many traders read wide bands as a busy market, with big swings.
  • Some traders read a price near the upper band as high compared with recent prices. Near the lower band, as low.
  • In a strong trend, the price can move along one band for a long time. A trend is the general direction of the price.
  • Some traders watch the middle line as the recent average price.
A daily chart of AAPL with Bollinger Bands: an orange middle line and two blue bands with a light blue shade between them. The bands come close together, then the price climbs along the upper band, and later it falls along the lower band.A daily chart of AAPL with Bollinger Bands: an orange middle line and two blue bands with a light blue shade between them. The bands come close together, then the price climbs along the upper band, and later it falls along the lower band.
AAPL, daily candles, with Bollinger Bands (BB 20, 2). 1 — the bands come close together: a calm stretch, which some call a squeeze. 2 — the price rises along the upper band, and the bands move apart. 3 — later, the price falls along the lower band.

An indicator only describes past prices. It cannot tell the future.

The settings

To open the settings, point at BB at the top left of the chart. Click the Settings button (the gear).

The Inputs tab shows:

  • Other Symbol — empty at the start. Pick a market here to draw the bands of that market instead.
  • length — how many bars the average and the bands cover. It starts at 20.
  • mult — how far the bands sit from the middle line. It starts at 2. A bigger number puts them further out.
  • Offset — moves all three lines left or right by a number of bars. It starts at 0.
  • MA Type — the kind of average for the middle line. It starts at SMA, the plain average.

The bands always use the close, the last price of each bar.

The Style tab changes the colours, the lines and the shade.

When it can mislead

  • A band is not a wall. Prices can close outside a band, and stay there.
  • Touching a band says little alone. In a strong trend, the price can touch the same band again and again.
  • The bands are late. They widen after a big move has already happened.
  • Gaps. A price jump between two bars widens the bands. They stay wide until that bar leaves the last 20.
  • Few bars. With fewer than 20 bars, there are no lines yet.
  • The last candle. The newest candle is still forming. Its values move until the candle closes.

Charts are for learning, not advice. Read our Risk Disclaimer.

An example

Open NASDAQ:AAPL on a daily chart. Each bar is one day. Add Bollinger Bands and keep the settings.

These numbers are made up, to show the idea:

  1. Say the last 20 closes average 100. The middle line is at 100.
  2. Say their spread is 2. This spread is called the standard deviation.
  3. The upper band is 100 + 2 × 2 = 104.
  4. The lower band is 100 − 2 × 2 = 96.

If the next days are calmer, the spread shrinks. The bands then move closer to the middle.

Twenty grey dots swing between about 96 and 104, inside a shaded box. On the last of them, an orange line starts at 100 and two blue bands start at 104 and 96. After that, the dots stay close to 100 and the blue bands move in toward the orange line.Twenty grey dots swing between about 96 and 104, inside a shaded box. On the last of them, an orange line starts at 100 and two blue bands start at 104 and 96. After that, the dots stay close to 100 and the blue bands move in toward the orange line.
The example as a picture. The grey dots are closes. The shaded part is the last 20 closes: their average is 100 and their spread is 2. So the orange middle line starts at 100, and the blue bands at 100 + 2 × 2 = 104 and 100 − 2 × 2 = 96. The next closes are calmer, so the bands move closer to the middle.

Technical details

This part is for readers who want the exact rules. It describes the chart's built-in version first, then KAGAMI's own version.

The calculation

The chart's built-in version works it out in your browser, on the bars the chart has loaded. It always uses the close of each bar. If Other Symbol is set, it uses that market's close, matched to the chart's bars by time.

  1. The middle line (Median): the average of the last length closes. MA Type picks the kind: SMA (simple), EMA (exponential) or WMA (weighted, newest bar heaviest).
  2. The spread: mean = simple average of the last length closes.
  3. SD = √( sum of (close − mean)² over the last length closes ÷ length ). It divides by length, not by length − 1.
  4. Upper = middle + mult × SD.
  5. Lower = middle − mult × SD.
  6. Offset moves all three drawn lines by that many bars. It does not change the values.

With the first settings, the first values are on bar number length.

The spread is always measured around the simple average. That holds even when MA Type is EMA or WMA. Then the bands sit around the EMA or WMA line, at a width set by the simple average's spread.

Inputs

InputDefaultRange / optionsWhat it does
Other Symbolemptyany marketEmpty = the chart's own market. Otherwise the lines are worked out from that market's closes.
length201 to 10,000, whole numbersThe number of bars in the average and in the spread.
mult20.001 to 50, decimals allowedHow many standard deviations the bands sit from the middle line.
Offset0−10,000 to 10,000Moves the lines right (a positive number) or left (a negative number) by that many bars.
MA TypeSMASMA, EMA, WMAThe kind of average for the middle line.

Colours

  • Median (the middle line): orange #FF6D00, 1 pixel wide.
  • Upper and Lower: blue #2196F3, 1 pixel wide.
  • Plots Background (the shade between the bands): blue #2196F3, 95% transparent.

These are the chart's own defaults. KAGAMI does not change them. You can change them in the Style tab.

KAGAMI's own version

KAGAMI's servers also have their own Bollinger Bands. They are not in the Indicators list. The chart shows them only when it is opened from a link that already asks for them. Your browser does no maths for them. It only draws the values the servers send.

  • Length and multiplier: 20 and 2, unless the link asks for other numbers. The multiplier may have decimals.
  • Price: always the close of each bar.
  • The maths: the middle line is the simple average of the last length closes. SD = √( sum of (close − middle)² ÷ length ), also divided by length. Upper = middle + multiplier × SD, lower = middle − multiplier × SD.
  • Where it starts: the first values are on bar number length. The servers fetch up to 300 extra bars before the part of the chart being drawn. So the lines usually reach the left edge.
  • Rounding: values are rounded to 6 decimal places.
  • Colours: all three lines are the same grey at 55% opacity: #8B90A8 in the dark theme and #5B607A in the light theme. They are 1 pixel wide. There is no shade between the bands.

How it differs from the built-in:

  • It always uses a simple average for the middle line. It has no MA Type, Other Symbol or Offset.
  • Its three lines are grey, with no shade between them.
  • Its values come from KAGAMI's servers, not from your browser.

With an SMA middle line and the same numbers, the two give the same values.

When values change

  • The built-in is worked out again each time the chart gets new prices. That is about every 15 seconds on most charts.
  • The newest candle is still forming, so its values move with the price. Once the candle closes, its values stay.
  • Past values do not change, as long as the bars they use stay the same.
  • KAGAMI's own version asks the servers for new values every 5 to 60 seconds, depending on the chart. Its newest values also move until the candle closes.
  • Indicators you add are not saved. They are gone when you reload the page.

Timeframes

  • It works on every timeframe. The timeframe is how much time each bar covers.
  • length counts bars, not time. 20 bars cover 5 hours on a 15-minute chart. On a daily chart, they cover 20 trading days.
  • Crypto charts also have timeframes of 1, 5, 10, 15 and 30 seconds. Stocks and FX start at 1 minute.
  • The lines run from bar to bar. Nights, weekends and holidays without bars are simply skipped.

Edge cases

  • Fewer bars than length: no lines.
  • Flat prices: the spread is zero. All three lines meet at that price.
  • length 1: the spread is always zero. All three lines sit on the close.
  • A very small mult: the bands sit almost on the middle line.
  • One very large bar: it widens the bands for length bars, then drops out.