Skip to main content
🟢 Beginner

Moving Average Calculator — SMA & Trend Smoothing

Calculate the Simple Moving Average (SMA) for any data series. Enter comma-separated values and choose a window size to smooth trends and filter noise. Free statistics tool.

What Is a Moving Average?

A moving average (also called a rolling average or running mean) smooths out short-term fluctuations in data to reveal underlying trends. Instead of looking at each individual data point — which may be noisy or variable — the moving average averages a fixed number of consecutive points, then "moves" the window forward one period at a time.

Moving averages are used everywhere data changes over time:

The Simple Moving Average (SMA) is the most straightforward type: the average of the last N values in the series. This calculator computes the SMA for your data and describes the resulting trend pattern.

How to Calculate a Simple Moving Average

The SMA formula is straightforward:

SMA(t) = [x(t) + x(t−1) + x(t−2) + ... + x(t−N+1)] / N

Where N is the window size (number of periods to average). The moving average "starts" at position N — you can't compute it for the first N−1 positions because there aren't enough prior values.

Step-by-step example with window = 3:

Data: 10, 12, 13, 15, 14, 16, 18, 17, 19, 21

PeriodValueSMA(3)
110
212
313(10+12+13)/3 = 11.67
415(12+13+15)/3 = 13.33
514(13+15+14)/3 = 14.00
616(15+14+16)/3 = 15.00
718(14+16+18)/3 = 16.00
817(16+18+17)/3 = 17.00
919(18+17+19)/3 = 18.00
1021(17+19+21)/3 = 19.00

The raw data fluctuates (14 at period 5, then 16 at period 6, then 18 at period 7, then dips to 17). The 3-period SMA smooths this, showing a steady upward trend from 11.67 to 19.00 — making the underlying growth pattern clear despite the noise.

Choosing the Right Window Size

The window size (N) is the most important parameter in moving average analysis. The trade-off is always between responsiveness and smoothness:

Window SizeSmoothnessLagBest For
2–3 periodsLight smoothingMinimalDaily data with small noise
5–7 periodsModerateLowWeekly cycle data (7 = weekly SMA)
10–14 periodsGoodModerateBi-weekly trends in sports/finance
20–26 periodsHighNoticeableMonthly trends, business data
50 periodsVery highSignificantMedium-term trend (stock 50-day MA)
200 periodsMaximumLargeLong-term trend (stock 200-day MA)

Key principles:

SMA vs. EMA vs. WMA: Types of Moving Averages

The Simple Moving Average is just one of several moving average variants, each with different weighting schemes:

TypeFormula ConceptWeightingAdvantage
SMA (Simple)Equal average of N periodsEqual weight to all N periodsSimple, transparent, unbiased
EMA (Exponential)More weight to recent valuesExponential decay, recent = heavierMore responsive, less lag
WMA (Weighted)Linear weights, most recent = highestLinear: period N gets weight N, period 1 gets weight 1Balance of recency and simplicity
DEMA (Double Exponential)EMA of EMA, reduces lag furtherComplex exponentialMinimal lag, advanced analysis

When to use EMA over SMA: In financial trading, EMAs are preferred because they react faster to recent price changes, reducing the lag that makes SMAs "miss" turning points. A 12-day EMA and 26-day EMA are the basis of the MACD (Moving Average Convergence Divergence) indicator. In sports science, SMA is usually sufficient — the data frequency is lower (weekly or monthly) and the precision advantage of EMA is minimal.

EMA formula: EMA(t) = x(t) × α + EMA(t−1) × (1 − α), where α = 2/(N+1). For N = 10: α = 2/11 = 0.182. Each new EMA value is 18.2% current value plus 81.8% previous EMA. The result smooths faster than SMA to trend changes while retaining memory of past values exponentially.

Using Moving Averages in Athlete Training Analysis

Moving averages have become a cornerstone of modern training load monitoring in endurance sports. The most sophisticated application is the Acute:Chronic Workload Ratio (ACWR), which uses two SMAs (or EMAs) to quantify training load balance and injury risk.

Acute:Chronic Workload Ratio (ACWR):

Research (Gabbett, 2016) suggests the "sweet spot" for injury risk minimization is ACWR between 0.8 and 1.3. Above 1.5 ("spike zone"), injury risk increases sharply — you're doing significantly more work this week than your body is adapted to handle. Below 0.8 suggests undertraining relative to your base fitness.

Example: A runner with a chronic weekly mileage of 50 miles (4-week average) should not jump to more than 65 miles (ACWR = 1.3) in a single week. If they ran 80 miles (ACWR = 1.6), they're in the elevated injury risk zone regardless of how "good" they felt doing it.

Performance trend analysis: Plot your weekly long run pace as a SMA with N=4. If the trend is downward (faster) over 8–12 weeks, your training is working. If it's flat or rising (slower), investigate: increasing fatigue, poor sleep, inadequate nutrition, or accumulated training stress may need to be addressed.

Heart rate monitoring: Resting heart rate as a 7-day SMA is a sensitive marker of fatigue and overtraining. A sustained rise of 5–7 bpm above your baseline 7-day SMA may signal incomplete recovery or approaching illness. Many elite athletes track this daily and modify training accordingly.

Moving Averages in Financial Data

Technical analysis of financial markets has developed a rich vocabulary around moving averages. Understanding these concepts helps whether you're tracking stock performance, cryptocurrency prices, or business revenue metrics.

The Golden Cross and Death Cross: When a short-period SMA (e.g., 50-day) crosses above a long-period SMA (e.g., 200-day), it's called a "golden cross" — historically associated with the beginning of bull markets. The reverse (50-day drops below 200-day) is a "death cross," associated with bear market signals. These are lagging indicators that confirm trend changes rather than predict them.

Support and resistance: Moving averages often act as dynamic support (in uptrends) or resistance (in downtrends) because many traders watch the same MAs and place orders near them. This self-fulfilling nature makes MAs important even if their purely statistical significance is modest.

Business metrics: Monthly recurring revenue (MRR), customer acquisition numbers, and churn rates all benefit from moving average smoothing to filter out month-to-month noise and reveal the underlying business trajectory. A 3-month SMA of MRR is a common dashboard metric for SaaS businesses.

Seasonality adjustment: For data with strong seasonal patterns (retail sales, tourism, agricultural yields), a 12-month SMA eliminates seasonality to reveal the underlying annual trend. If each window contains exactly one full seasonal cycle, the SMA will average out the seasonal component entirely, leaving only trend and irregular variation.

Limitations of Simple Moving Averages

Despite their versatility, SMAs have important limitations to keep in mind:

Frequently Asked Questions

What is a simple moving average (SMA)?

A Simple Moving Average (SMA) is the unweighted mean of the last N values in a time series. For each new period, the oldest value drops out of the calculation and the newest value is added. It smooths short-term fluctuations to reveal underlying trends. The formula is: SMA = (x₁ + x₂ + ... + xₙ) / N for the N most recent values.

How do I choose the window size for a moving average?

Match the window size to the pattern you want to smooth. To eliminate daily variation in weekly-cycle data, use N = 7. For monthly trends in daily data, use N = 30. For long-term trends, use N = 50–200. Larger windows produce smoother averages but lag further behind current values. Start with N = 3–7 for general data exploration, then adjust based on what patterns you need to see.

What is the difference between SMA and EMA?

Both smooth data, but they weight observations differently. SMA gives equal weight to all N periods in the window. EMA (Exponential Moving Average) gives exponentially more weight to recent values, making it more responsive to current changes but retaining influence from all past data. EMA has less lag than SMA of the same period, making it preferred in fast-moving data like stock prices. SMA is simpler and more transparent.

Why does my moving average have fewer values than my data?

That's expected. A moving average with window N cannot be computed for the first N−1 periods — there aren't enough prior values yet. So a 5-period SMA applied to 12 data points produces 12 − 5 + 1 = 8 SMA values. This is called the "warm-up" period. The first valid SMA value appears at position N (period N).

Can I use a moving average to predict future values?

A moving average describes trends, it doesn't predict future values by itself. You can extrapolate a trend line fitted to the SMA values forward, but this is an assumption that the trend continues — which may or may not be true. For proper forecasting, use time series models like ARIMA, exponential smoothing (Holt-Winters), or machine learning approaches that account for trend, seasonality, and uncertainty.