LoginEnter the platform free
DOMINATechnical analysisThe indicators › Simple moving average (SMA)

Simple moving average (SMA): how to calculate it and how to read it

InteractivePick the periods of the averages yourselfOne or two averages between 10 and 200 days: the real chart redraws and the page counts closes above, below and crossovers.Try it →

The simple moving average on a real stock

Trend indicator · average of the last n closes · classic periods: 20, 50 and 200 days
Simple moving average (SMA)
Example: Microsoft, sessions from to · 50-day and 200-day SMAs · adjusted prices, to the cent
volumeperiod start 415.5150-day SMA200-day SMAdeath crossgolden cross541.06352.67487.48Jan 2, 2025Apr 3, 2025Jul 3, 2025Oct 1, 2025Dec 30, 2025
Sessions249Above the 50-day SMA121Below12850/200 crossovers2

In amber the 50-day SMA, in blue the 200-day SMA. The 50-day crossed below the 200-day on (death cross) and back above it on (golden cross).

InteractiveRead a session. Click a day on the chart above: I tell you the close, the averages on that day and how far the price is from them.

1/nthe weight of each close in the averagein a 50-day SMA each close counts for 2%; in a 200-day SMA, 0.5%

What the simple moving average is

Fig. 1 · Anatomy

the window: the last n closesit moves one step forward every sessionthe average of this windowpriceone close per sessionsimple moving averagethe average of the last n closes
  • The black line is the price: one close per session.
  • The amber line is the average of the last n closes: the band shows which ones go into the sum.
  • Every session the new close comes in and the oldest drops out: that is why it is moving.
  • Every close carries the same weight: that is why it is simple.
SMA(n) = (C1 + C2 + … + Cn) / n  ·  C = the last n closes
next session: new sum = old sum − close dropped + close added

The calculation, step by step

Microsoft, 5-day SMA, last closes of 2025
The last six closes of 2025 for Microsoft and the 5-day simple moving average, in dollars
SessionCloseSum of the last 55-day SMA
484.92
486.85
488.02
487.71
487.102,434.60486.920
487.482,437.16487.432
The simple moving average of Microsoft at the close of , worked out
StepCalculationResult
Add the 5 closes up to 484.92 + 486.85 + 488.02 + 487.71 + 487.102,434.60
Divide by 5: that is the 5-day SMA for that day2,434.60 / 5$486.920
Next session, : drop the oldest close, add the new one2,434.60 − 484.92 + 487.482,437.16
Divide by 5 again2,437.16 / 5$487.432
50-day SMA: the same sum over 50 closes24,836.35 / 50$496.727
200-day SMA: the same sum over 200 closes95,156.98 / 200$475.785

From to the 5-day SMA rose: the close that came in ($487.48) is higher than the one that dropped out ($484.92). That is all there is to the slope of a moving average.

20, 50 and 200 days: which period

Fig. 2 · Short, medium, long

20-day50-day200-day
  • The 20-day SMA, one month of trading, follows the price closely.
  • The 50-day SMA, just under a quarter, is smoother.
  • The 200-day SMA, about ten months of trading, moves slowly and turns last.
  • A long average starts late: it needs 200 sessions before its first value.
How much time a moving average covers: a trading week has 5 sessions, a month about 21
SessionsTrading weeksMonths, approx.Weight of each close
1020.510%
2041.05%
50102.42%
100204.81%
200409.50.5%

The longer the period, the less each close weighs: the average gets smoother and slower. The 20, 50 and 200-day periods are conventions: they are the ones seen most often on daily charts, not numbers with special properties.

How to read it: price, slope, crossover, lag

Fig. 3 · Above or below, and the slope

price above the SMAprice below the SMAthe SMA risesthe SMA falls
  • Price above the SMA: recent closes are higher than their average.
  • Price below the SMA: they are lower.
  • The SMA rises when the close coming in is higher than the one dropping out.

Fig. 4 · The crossover of two averages

death crossthe fast one crosses below the slow onegolden crossthe fast one crosses above the slow onefast SMA (50)slow SMA (200)
  • Two SMAs go on the same chart: a fast one and a slow one.
  • Death cross: the 50-day SMA crosses below the 200-day.
  • Golden cross: the 50-day SMA crosses above the 200-day.
  • They are names for an event on the chart, not a forecast: they tell what the price has already done.

Fig. 5 · The lag

the price highthe SMA highthe lagthe price has already fallen
  • The price makes its high and turns: the SMA keeps rising for a while.
  • The SMA turns only when the closes coming in are lower than the ones dropping out.
  • The longer the average, the longer the lag: that is its limit.

Fig. 6 · The sideways market

8 crossings in a short timewith no trend the SMA says little
  • With no trend the price swings up and down around the SMA.
  • It crosses it again and again, and each crossing is short-lived.
  • A moving average describes a trend: where there is no trend, it says little.

The chart at the top lets you measure the lag: the 2025 low of Microsoft came on , at $352.67. The golden cross arrived on , 42 sessions later, with the close at $471.09. The average arrives after the price because it is made of past closes.

The reading rules

six things to look at, one at a time

1The slope is the trend

  • rising SMA: the new closes are higher than those of n sessions ago
  • flat SMA: no trend to describe

2The price above or below

  • above the SMA: the price is higher than its recent average
  • moving from one side to the other is a crossing

3The distance from the average

  • it is measured as a percentage of the SMA
  • when the price runs the distance grows: the SMA follows it with a lag

4The crossover of two averages

  • fast above slow: the short period is higher than the long one
  • with 50 and 200 days: golden cross upward, death cross downward

5The period changes everything

  • short: it reacts sooner and gets crossed more often
  • long: smoother, slower, fewer crossings

6In a sideways market it says little

  • with no trend the price keeps crossing the SMA
  • crossovers multiply and do not last

The simple average gives the same weight to every close in the window. The other averages in the family change the weights to reduce the lag: the exponential moving average (EMA) and the weighted moving average (WMA) give more weight to recent closes. The 20-day simple average is also the centre line of Bollinger Bands.

InteractiveTry the periods

one or two averages: the chart below changes with you
First SMA (amber)
Second SMA (blue)

The counts cover the 2025 sessions of Microsoft. A crossing is a close that moves from above the first SMA to below it, or the other way round.

In amber the 50-day SMA, in blue the 200-day. The circles mark the crossovers: green upward, red downward.

Closes above the 50-day SMA121out of 249 sessions in 2025
Closes below the 50-day SMA12851.4% of the sessions
Price crossings18the price crosses the 50-day SMA
Crossovers of the two SMAs250-day against 200-day
In 2025 Microsoft closed 121 sessions above its 50-day SMA and 128 below it; the price crossed it 18 times. The 50-day SMA crossed the 200-day 2 times: downward on (death cross), upward on (golden cross). A shorter average gets crossed more often: change the period and watch the crossings.

Interactive exerciseFind the death cross and the golden cross

Microsoft, 2025: two clicks on the chart, the judge tells you whether they are right and why
  1. Click where the 50-day SMA (amber) crosses below the 200-day (blue): that is the death cross.
  2. Click where the 50-day crosses back above the 200-day: that is the golden cross.
  3. Read the verdict. Tolerance: 10 sessions before or after the crossover, two trading weeks.
click the first crossover

Two lines: amber the 50-day SMA, blue the 200-day. Find the two points where they cross.

Where to go from here

The indicators · Moving averages

The other lessons in the guide

What is technical analysis

  • the study of price and volume to recognise the trend and the levels
  • three premises: price discounts everything, trends, history repeats
  • exercise: uptrend, downtrend or sideways on three real charts

Candlestick chart

  • the four prices of a session: body and shadows
  • green and red, long and short bodies, long shadows, the doji
  • find the candle on a real chart: the judge says yes or no with the numbers

Uptrend: higher highs and higher lows

  • higher highs and higher lows: how to recognize an uptrend
  • swing points, and the two signals that end a trend
  • mark the higher lows yourself on a real chart

Support and resistance

  • the level where the decline stopped, and the one where the rise stopped
  • touches, time and volume: how much a level counts; once broken, it switches roles
  • find the level yourself on a real chart: the judge counts the touches

Frequently asked questions

What is a simple moving average (SMA)?

It is the arithmetic mean of the last n closing prices of a stock, recalculated every session: the new close comes in, the oldest drops out. Every close carries the same weight. On the chart it is a line that follows the price with a lag and shows its trend without the noise of single days.

How do you calculate a simple moving average?

Add the last n closes and divide by n. A real example: the five closes of Microsoft up to add up to $2,434.60; divided by 5 that is $486.920. The next session you drop the oldest close, add the new one and divide by 5 again.

Which periods are most used for a moving average?

On daily charts 20, 50 and 200 days: about a month, just under a quarter and about ten months of trading. The short average follows the price closely and gets crossed often; the long average is smoother and turns later. They are widespread conventions, not numbers with special properties.

What are the golden cross and the death cross?

They are the two crossovers of the 50-day and the 200-day SMA. Golden cross: the 50-day crosses above the 200-day. Death cross: it crosses below. On Microsoft in 2025 the death cross came on and the golden cross on . They describe what the price has already done: they arrive late, like every moving average.

Method and sources

The sources of this page: the books are cited, the text is ours
Source
John J. Murphy, Technical Analysis of the Financial Markets: chapter 9, moving averages.
Charles D. Kirkpatrick and Julie R. Dahlquist, Technical Analysis (CMT curriculum): moving averages.

The chart uses the Microsoft sessions from to in our archive, adjusted for dividends and corporate actions and rounded to the cent: 2025 is shown, the 2024 sessions are needed to calculate the 200-day SMA. The numbered figures are diagrams drawn to explain, not prices. This guide explains how the tools work: it does not contain investment recommendations and promises no returns. Our method · licence · report an error.