Moving Average Calculator: SMA, EMA and WMA Explained
By FindMySum · Last reviewed
A moving average smooths a series of numbers by averaging a fixed number of the most recent values at each point. It is one of the most widely used tools in investing and in business forecasting, because it removes day-to-day noise and shows the direction of a trend. This moving average calculator computes the three common types for any series you paste in: simple (SMA), exponential (EMA) and weighted (WMA), plus crossovers between a short and a long average.
Simple moving average (SMA)
The simple moving average of period N is the ordinary mean of the last N values:
SMA = (x₁ + x₂ + … + x_N) ÷ N
As each new value arrives, the oldest one drops out of the window. Every value inside the window counts equally, and a value leaving the window can make the average jump even if nothing new happened. In a spreadsheet, it is AVERAGE over a sliding range.
Weighted moving average (WMA)
A linearly weighted moving average gives the newest value weight N, the one before it N − 1, and so on down to 1 for the oldest:
WMA = (1 × x₁ + 2 × x₂ + … + N × x_N) ÷ (1 + 2 + … + N)
The divisor is N × (N + 1) ÷ 2, which is 55 for a 10-period average. Because recent values count more, the WMA turns sooner than the SMA when the data changes direction.
Exponential moving average (EMA)
The exponential moving average updates the previous average by a fixed share α of the gap between the new value and that average:
EMA_today = α × value_today + (1 − α) × EMA_yesterday
With the usual convention α = 2 ÷ (N + 1), a 10-period EMA gives the newest value about 18% of the weight. Older values never fully drop out; their influence fades geometrically. In statistics the same formula is called single exponential smoothing, where α is often chosen by fitting past data rather than from a period. The first EMA has nothing to update, so it is seeded with the simple average of the first N values.
A worked example
The calculator starts with 20 daily closing prices from the StockCharts teaching example and a 10-period window.
- The first complete SMA, at day 10, is the average of the first ten prices: 22.221.
- The 10-period EMA starts at that same value. On day 11 the price is 22.15, so EMA = 0.1818 × 22.15 + 0.8182 × 22.221 = 22.208.
- By day 20 the SMA is 23.21, the EMA 23.34 and the WMA 23.53. The prices rose sharply from day 14, so the WMA and EMA, which weight recent values more, sit above the SMA.
Choosing a period
The period sets the trade-off between smoothness and lag. A short period follows the data closely but lets noise through; a long one is smooth but responds late. For daily stock prices, 10 or 20 days describe the short-term trend and 50 or 200 days the long-term one. For monthly business data, 3 months smooths noise, and 12 months removes seasonal patterns entirely because every month of the year is always in the window.
Crossovers
Enter a long period to compare two averages of the same type. When the short average rises above the long one, recent values have moved above the longer-term level: an upward crossover. The reverse is a downward crossover. The table marks each crossover, and the results show the most recent one.
Crossovers are popular as trading signals, but they come after the move has started, and in sideways markets they flip back and forth. Treat them as a description of what the data has done.
Practical tips
- Enter values oldest first, separated by commas, spaces or new lines.
- Make sure the intervals are equal: a gap such as a missing month distorts every average that spans it.
- For prices, use closing prices consistently; adjusted closes account for dividends and splits.
- The calculator rounds results to four decimals, enough for prices and most business data.
This page is for information and learning. It describes past data and is not investment advice.
More questions
What are the 50-day and 200-day moving averages?
They are simple moving averages of a stock's daily closing prices over the last 50 and 200 trading days, roughly ten weeks and ten months. Financial media quote them because many investors watch them, which can make them self-reinforcing reference points. Paste at least 200 closing prices to calculate them here.
Does a moving average work with weekly or monthly data?
Yes. The period is counted in whatever interval your data uses, so a 12-period average of monthly sales covers a year and a 4-period average of weekly data covers about a month. Keep the interval constant through the series.
Why does my charting platform show a slightly different EMA?
Platforms differ in how they start the EMA (first value or first simple average), how many past values they load before your chart begins, and how they round. The differences shrink as more data is used; after a few times N values the starting point barely matters.
Is a moving average the same as a trend line?
No. A trend line is a single straight line fitted to the whole series, usually by least squares. A moving average is recalculated at every point and bends with the data. For a straight-line fit and its slope, use a regression calculator instead.
Can moving averages predict prices?
Not reliably. They summarise past prices and always lag. Research on simple trading rules based on crossovers shows mixed results once trading costs are included. Use them to see the direction of a trend, not as a forecast.
Sources
This article explains how the calculator works and is general information, not financial, tax, legal or medical advice. Rules change; check the sources above or a qualified professional before you act.