Money and Finance

RSI, MACD and Bollinger Bands: How the Indicators Are Calculated

How moving averages, RSI, MACD and Bollinger Bands are calculated from prices, how to read them and why numbers differ between charting platforms.

Saizul Amin
Saizul Amin30 Oct 2026 · 3 min read
RSI, MACD and Bollinger Bands: How the Indicators Are Calculated

RSI, MACD and Bollinger Bands: How the Indicators Are Calculated

Technical indicators appear on every trading app, but few traders know exactly how they are calculated. That matters: tiny differences in definition explain why two platforms show different RSI values for the same stock. The Technical Indicators Calculator follows the original definitions and shows the numbers.

Moving averages

A simple moving average (SMA) is the average of the last n closing prices. It smooths noise but lags behind the price.

An exponential moving average (EMA) weights recent prices more. Each new value is:

EMA = price × k + previous EMA × (1 − k), with k = 2 ÷ (n + 1)

EMAs react faster than SMAs. Because each value depends on the previous one, the first values depend on how the series is started; longer series reduce that effect.

RSI

J. Welles Wilder introduced the relative strength index in 1978. It compares average gains with average losses over n periods (usually 14):

RSI = 100 − 100 ÷ (1 + average gain ÷ average loss)

Wilder's averages start as simple averages of the first 14 changes, then are smoothed: new average = (previous × 13 + current) ÷ 14. Some platforms use simple or exponential averages instead, which gives different numbers.

Readings above 70 are commonly called overbought, below 30 oversold. In strong trends, RSI can stay at extremes for a long time.

MACD

Gerald Appel's moving average convergence divergence is the 12-period EMA minus the 26-period EMA. The signal line is a 9-period EMA of MACD, and the histogram is MACD minus the signal. Crossovers of MACD and its signal are read as changes in momentum.

Bollinger Bands

John Bollinger's bands are a 20-period SMA plus and minus two standard deviations of the last 20 prices, using the population formula (dividing by n, not n − 1). Two derived measures:

  • %B: where the price sits within the bands; 1 at the upper band, 0 at the lower.
  • Bandwidth: the width of the bands relative to the middle; a squeeze often comes before larger moves.

A worked example

On the sample series of 33 closes ending at 43.13:

IndicatorValue
SMA2045.24
EMA2044.68
RSI1437.8
MACD / signal−0.50 / −0.14
Upper / lower band47.62 / 42.86
%B0.06

Momentum has turned down, and the price is near the lower band, but RSI is not yet oversold.

Do indicators work?

Academic studies generally find that simple technical rules do not reliably beat buy-and-hold after costs in liquid markets. Indicators describe what has happened to momentum and volatility; they do not predict what will happen. Many traders use them to time entries within a broader plan, or to manage risk, rather than as a system on their own.

Why platforms differ

  • RSI smoothing method.
  • EMA starting value.
  • Sample versus population standard deviation in bands.
  • Different closing times or adjusted versus unadjusted prices.

How to use the calculator

  1. Paste closing prices, oldest first.
  2. Set the moving average, RSI period and band width.
  3. Read the latest values and the 15-period table.

Test several scenarios

Numbers from any model are only as good as the inputs. Before acting on a result, change the key assumptions up and down and see how much the answer moves. If a small change in one input flips the conclusion, treat the result with caution and look for better data. Keep a short note of the inputs you used, the date and the source of each figure, so that you can repeat the calculation later and compare it with what actually happened. Over time this record shows which assumptions were reliable and which were too optimistic, and it makes your next decision better informed.

Limits

An analysis aid, not investment advice.

Completely freeNo cost, no sign-up
Files stay privateEverything runs in your browser
Easy in your languageAvailable in many languages