Skip to main content
Skip to main content
DigiCalcs
Back to Guides
6 min read5 Steps

How to Calculate Moving Average: Step-by-Step Guide

Learn to manually calculate Simple Moving Average with this step-by-step guide. Understand the formula, worked example, common pitfalls, and when to use a calculator.

Skip the math — use the calculator

Step-by-Step Instructions

1

Identify Your Data and Period

Begin by clearly defining the data series you wish to analyze (e.g., `[10, 12, 11, 13, 15, 14, 16, 17, 15, 18]`). Next, select the specific period 'n' for your Simple Moving Average (SMA). This 'n' determines how many data points will be included in each average calculation. For instance, if you choose a 3-period MA, 'n' will be 3.

2

Apply the Simple Moving Average Formula

Understand the core formula for SMA: `SMA = (Sum of 'n' data points) / n`. This formula dictates that for each calculation, you will sum 'n' consecutive data points and then divide that sum by 'n' to find the average for that specific window.

3

Calculate the First Moving Average Point

Take the first 'n' data points from your series. Sum these 'n' values together. Once you have the sum, divide it by 'n'. This result is your very first moving average point. For example, with `n=3` and data `[10, 12, 11]`, the sum is `10 + 12 + 11 = 33`, and the first SMA is `33 / 3 = 11.00`.

4

Iterate for Subsequent Points

To calculate the next moving average point, 'move' your window forward by one data point. This means dropping the oldest data point from your previous window and adding the next new data point from your series. Repeat the summation and division (as in Step 3) for this new set of 'n' data points. Continue this process until you have calculated a moving average for every possible window in your dataset.

5

Interpret the Trend

Once you have a series of moving average points, observe how they change over time. An upward-sloping moving average generally indicates an uptrend, while a downward-sloping one suggests a downtrend. A relatively flat moving average often implies a sideways or consolidating market. Remember that the moving average smooths out fluctuations, providing a clearer view of the underlying direction.

How to Calculate Moving Average: Step-by-Step Guide

Understanding and calculating the Moving Average (MA) is a fundamental skill in data analysis, particularly in finance, economics, and various scientific fields. It helps to smooth out price data over a specified period by creating a constantly updated average price. This process effectively filters out short-term fluctuations, making it easier to identify underlying trends and patterns.

This guide will walk you through the manual calculation of a Simple Moving Average (SMA), providing you with the knowledge to perform this calculation by hand and a deeper understanding of its mechanics.

What is a Moving Average?

A Moving Average is a technical analysis tool that averages a data series (e.g., stock prices, sales figures, temperature readings) over a specific period. As new data becomes available, the oldest data point is dropped, and the newest one is added, creating an average that "moves" over time. The primary purpose is to reduce noise and highlight the direction of a trend, making it easier to interpret data.

Prerequisites

Before you begin, ensure you have the following:

  • A Series of Data Points: This is the raw data you wish to analyze (e.g., daily closing prices for a stock, weekly sales numbers). The more data points you have, the more moving average points you can calculate.
  • A Chosen Period (or Window Size): This is the number of data points you want to include in each average calculation (e.g., a 5-day moving average, a 20-week moving average). This period is often denoted as 'n'.

The Simple Moving Average (SMA) Formula

The Simple Moving Average (SMA) is the most basic form of a moving average. It is calculated by summing a specific number of data points and then dividing the result by the number of points in that period.

The formula for a Simple Moving Average (SMA) is:

SMA = (Sum of 'n' data points) / n

Where:

  • Sum of 'n' data points is the total value of the data points within the chosen period.
  • n is the number of data points in the period (the window size).

Worked Example: Calculating a 3-Period Simple Moving Average

Let's assume we have the following daily closing prices for a hypothetical stock over ten days:

Data Series: [10, 12, 11, 13, 15, 14, 16, 17, 15, 18]

We want to calculate a 3-period Simple Moving Average (n=3).

  1. First MA Point (Days 1-3):

    • Data: [10, 12, 11]
    • Sum = 10 + 12 + 11 = 33
    • SMA = 33 / 3 = 11.00
  2. Second MA Point (Days 2-4):

    • Data: [12, 11, 13] (Drop 10, add 13)
    • Sum = 12 + 11 + 13 = 36
    • SMA = 36 / 3 = 12.00
  3. Third MA Point (Days 3-5):

    • Data: [11, 13, 15] (Drop 12, add 15)
    • Sum = 11 + 13 + 15 = 39
    • SMA = 39 / 3 = 13.00
  4. Fourth MA Point (Days 4-6):

    • Data: [13, 15, 14] (Drop 11, add 14)
    • Sum = 13 + 15 + 14 = 42
    • SMA = 42 / 3 = 14.00
  5. Fifth MA Point (Days 5-7):

    • Data: [15, 14, 16] (Drop 13, add 16)
    • Sum = 15 + 14 + 16 = 45
    • SMA = 45 / 3 = 15.00
  6. Sixth MA Point (Days 6-8):

    • Data: [14, 16, 17] (Drop 15, add 17)
    • Sum = 14 + 16 + 17 = 47
    • SMA = 47 / 3 = 15.67 (rounded to two decimal places)
  7. Seventh MA Point (Days 7-9):

    • Data: [16, 17, 15] (Drop 14, add 15)
    • Sum = 16 + 17 + 15 = 48
    • SMA = 48 / 3 = 16.00
  8. Eighth MA Point (Days 8-10):

    • Data: [17, 15, 18] (Drop 16, add 18)
    • Sum = 17 + 15 + 18 = 50
    • SMA = 50 / 3 = 16.67 (rounded to two decimal places)

Resulting 3-Period SMA Series: [-, -, 11.00, 12.00, 13.00, 14.00, 15.00, 15.67, 16.00, 16.67]

Note: The first n-1 (in this case, 2) data points will not have a corresponding moving average value, as there aren't enough preceding data points to form a full window.

Common Pitfalls to Avoid

  • Incorrect Period Selection: Choosing too short a period can result in a moving average that is too sensitive to noise, while too long a period can make it too slow to react to genuine trend changes. The optimal period depends on the data and the analytical objective.
  • Misinterpreting the Lagging Nature: Moving averages are inherently lagging indicators. They are based on past data, meaning they will always confirm a trend after it has already begun. Do not expect them to predict future movements with precision.
  • Calculation Errors: Manual calculation, especially with large datasets or complex numbers, is prone to arithmetic mistakes. Double-check your sums and divisions.
  • Confusing MA Types: This guide focuses on SMA. Other types, like Exponential Moving Average (EMA) or Weighted Moving Average (WMA), use different formulas that give more weight to recent data. Ensure you are using the correct formula for the type of moving average you intend to calculate.
  • Not Handling Initial Data Points: Remember that the first n-1 data points will not have a moving average value because there aren't enough preceding data points to fill the window.

When to Use a Calculator for Convenience

While understanding the manual calculation is crucial for comprehension, a dedicated Moving Average calculator offers significant advantages in practical applications:

  • Large Datasets: Manually calculating moving averages for hundreds or thousands of data points is time-consuming and error-prone. A calculator handles this instantly.
  • Varying Periods: Easily switch between different 'n' periods (e.g., 5-day, 20-day, 50-day MA) without recalculating everything from scratch.
  • Different MA Types: Many calculators support various moving average types (SMA, EMA, WMA), allowing you to compare their effects without needing to learn multiple complex formulas.
  • Speed and Accuracy: Calculators eliminate human error and provide results almost instantaneously, allowing for quicker analysis and decision-making.
  • Real-time Analysis: In fast-moving environments like financial markets, a calculator is indispensable for generating real-time moving averages.

Conclusion

Calculating a Simple Moving Average manually provides a solid foundation for understanding how trends are identified and smoothed from raw data. By following the steps outlined in this guide, you can confidently perform this calculation. While manual computation is excellent for learning, leveraging a dedicated calculator will enhance your efficiency and accuracy when dealing with larger or more complex datasets, allowing you to focus on interpreting the insights derived from the moving averages.

Ready to Calculate?

Skip the manual work and get instant results.

Open Calculator

Settings

PrivacyTermsAbout© 2026 DigiCalcs