Moving Average Calculator
Enter the period and up to five prices, oldest first, to find the simple moving average, the rolling averages and an EMA.
Updated
Moving Average Calculator
Our Moving Average Calculator finds the simple moving average (SMA) of a short price series. Choose a period from 1 to 5 and type up to five prices, oldest first. The average of the latest prices appears at once, with the working, the sum and how far the latest price sits above or below the average. Type more prices than the period and you also get the rolling averages, the change in the average and an exponential moving average (EMA). It works for stock prices, sales figures or any series of numbers.
Quick answer
A simple moving average is the sum of the latest n prices ÷ n: (50 + 75 + 100) ÷ 3 = 75.
- Period n: how many of the latest prices to average, here 3.
- It moves: add 110 next and the average becomes (75 + 100 + 110) ÷ 3 = 95.
- Smoothing: a longer period gives a smoother, slower line.
- EMA: gives the newest price more weight, with α = 2 ÷ (n + 1).
What Is a Moving Average?
A moving average is the average of the last n values in a series, worked out again each time a new value arrives. The oldest value drops out and the newest comes in, so the average "moves" along the data. It smooths out short swings and makes the underlying direction easier to see, which is why it is one of the most used tools in technical analysis and in sales or demand forecasting.
- P1 to Pn: the latest n values, such as daily closing prices.
- n: the period, the number of values in each average.
- SMA: simple moving average, where every value has the same weight.
How to Calculate a Moving Average
Take five closing prices, oldest first: 50, 75, 100, 110 and 120. For a 3-period moving average, average each run of three prices:
(75 + 100 + 110) ÷ 3 = 95
(100 + 110 + 120) ÷ 3 = 110
- Pick the period. Here n = 3.
- Add the first n prices. 50 + 75 + 100 = 225, and 225 ÷ 3 = 75.
- Move one step. Drop 50, add 110: (75 + 100 + 110) ÷ 3 = 95.
- Repeat to the latest price. The current 3-period average is 110.
The calculator shows 110 as the result and lists 75, 95, 110 as the rolling averages. The latest price, 120, is 10 above its average.
Moving Average Examples
| Prices ÷ period | SMA |
|---|---|
| 50, 75, 100 225 ÷ 3 | 75 |
| 120.5, 42, 224.65, 129 516.15 ÷ 4 | 129.0375 |
| 80, 95, 105, 115, 125 520 ÷ 5 | 104 |
In the second row one price, 224.65, is far above the others. The 4-period average of 129.0375 still includes it, but each price only counts for a quarter, so a single spike moves the average much less than it moves the price. In the last row the prices climb steadily, and the latest price of 125 is 21 above the 5-period average of 104.
How a Moving Average Smooths Prices
Here are seven daily prices, 10, 12, 14, 13, 15, 17 and 16, with their 3-day moving average. The price zigzags, but the average climbs by exactly 1 a day: 12, 13, 14, 15, 16.
The price of the day before always drops out as a new one comes in. A longer period, such as 50 or 200 days on a stock chart, smooths even more but reacts more slowly when the trend turns.
Simple vs Exponential Moving Average
An exponential moving average (EMA) gives recent prices more weight than older ones, so it turns faster than an SMA of the same period. It starts from the first SMA and then updates with each new price:
EMA = α × P + (1 − α) × EMA prev
With n = 3, α = 0.5. Prices of 20, 20, 20, 20 and then a jump to 30 give a 3-period SMA of (20 + 20 + 30) ÷ 3 ≈ 23.33, while the EMA is 0.5 × 30 + 0.5 × 20 = 25. The EMA has moved more of the way toward the new price. This calculator shows the EMA row once you type more prices than the period. With only five prices it is a short example: charting tools use long price histories, so their EMA values settle and differ less from one starting point to another.
How Moving Averages Are Used
- Trend direction. A rising average points to an uptrend and a falling one to a downtrend.
- Price vs average. A price above its average is often read as strength, below as weakness.
- Crossovers. Traders watch a short average crossing a long one, such as the 50-day and 200-day.
- Support and resistance. Prices sometimes pause near a widely watched average.
- Forecasting. In sales or demand data, the latest average is a simple forecast for the next period.
A moving average lags because it is built from past prices. It describes the trend, it does not predict it, so use it with other information rather than as a buy or sell signal on its own.
Key Terms
- SMA
- Equal-weight average of the last n values.
- EMA
- Average that weights recent values more.
- Period
- Number of values in each average.
- Lag
- How far the average trails the price.
- Crossover
- Two averages, or price and average, crossing.
How to Use the Moving Average Calculator
- Enter the period. Type how many prices go into each average, a whole number from 1 to 5, such as 3.
- Enter the prices, oldest first. Type at least as many prices as the period, starting with the oldest in Price 1, such as 50, 75 and 100. You can fill up to five.
- Read the moving average. The simple moving average of the latest prices appears as you type, with the working, the sum and how far the latest price is above or below it.
- Check the rolling rows and copy. With more prices than the period you also see the rolling averages, the change in the average and an EMA. Press Copy to copy the result, or Clear or Esc to start again.
Example: a 3-period average of 50, 75, 100, 110 and 120. The rolling averages are 75, 95 and 110, so the current moving average is (100 + 110 + 120) ÷ 3 = 110.
Who Can Use This Calculator?
Frequently Asked Questions (FAQs)
What is the moving average formula?
A simple moving average is the sum of the latest n values divided by n: SMA = (P1 + P2 + … + Pn) ÷ n. Each new value replaces the oldest one in the next average.
What is the 3-period moving average of 50, 75 and 100?
It is 75. (50 + 75 + 100) ÷ 3 = 225 ÷ 3 = 75. If the next price is 110, the next 3-period average is (75 + 100 + 110) ÷ 3 = 95.
What is the difference between SMA and EMA?
An SMA gives every value in the period the same weight. An EMA uses α = 2 ÷ (n + 1) to give the newest value more weight, so it reacts faster to price changes.
Which order should I enter the prices in?
Oldest first. Price 1 is the oldest and the last price you fill is the newest. The result is the average of the newest n prices.
What period should I use for a moving average?
Short periods react quickly but stay noisy, long periods are smoother but slower. On stock charts 20, 50 and 200 days are common. This calculator takes periods from 1 to 5.
Why does a moving average lag the price?
It averages past values, so when the price turns, the average only follows once enough new prices have replaced the old ones. Longer periods lag more.
Can I use a moving average for data other than stock prices?
Yes. It works for sales, website visits, temperatures or any series of numbers in time order.
Is the Moving Average Calculator free?
Yes. It is completely free, needs no sign-up, and can be used as many times as you like.
Sources
- Wikipedia. Moving average.
- StockCharts ChartSchool. Moving Averages: Simple and Exponential.
- NIST/SEMATECH e-Handbook of Statistical Methods. Single Moving Average.
- Corporate Finance Institute. Exponential Moving Average (EMA).
- Wikipedia. Technical analysis.
Use our Moving Average Calculator to smooth any price series and see its trend in seconds.