Learn How to Calculate Moving Averages
What Are Moving Averages and Why Traders Use Them A moving average is a mathematical calculation that smooths out price data over a specific period of time....
What Are Moving Averages and Why Traders Use Them
A moving average is a mathematical calculation that smooths out price data over a specific period of time. Instead of looking at a single day's stock price, a moving average shows the average price across multiple days, weeks, or months. This tool helps traders and investors spot trends by filtering out the "noise" of daily price fluctuations.
Think of it this way: if a stock's price bounces up and down every day between $48 and $52, the actual trend might be difficult to see. A moving average would smooth these ups and downs to show whether the overall direction is trending upward, downward, or staying relatively flat.
Traders use moving averages for several practical reasons. First, they help identify the direction of a trend. When prices are above their moving average, an uptrend may be present. When prices fall below their moving average, a downtrend may be occurring. Second, moving averages can signal potential entry and exit points. For example, some traders watch for when a short-term moving average crosses above a longer-term moving average—an event called a "golden cross"—which may suggest buying opportunities.
Moving averages work across different time frames and asset classes. Stock traders use them, bond investors reference them, and currency traders incorporate them into their strategies. According to financial data from the past decade, moving averages remain among the most widely used technical indicators in trading platforms worldwide, appearing in nearly every professional charting tool available.
Practical Takeaway: Moving averages transform scattered daily price movements into clear trend lines. Understanding how to calculate and interpret them provides foundational knowledge for analyzing price behavior in any market.
Simple Moving Average (SMA) Calculation Step-by-Step
The Simple Moving Average, or SMA, is the most straightforward version. It calculates the average price by adding up closing prices over a set number of days and dividing by that number of days. Here's how to calculate it manually.
Let's use a real example. Suppose a stock closed at these prices over 5 days: Monday $100, Tuesday $102, Wednesday $101, Thursday $103, Friday $104. To calculate a 5-day SMA:
- Add all closing prices: $100 + $102 + $101 + $103 + $104 = $510
- Divide by the number of days: $510 ÷ 5 = $102
- The 5-day SMA is $102
The next day, when you calculate a new 5-day SMA, you drop the oldest price (Monday's $100) and add the new closing price. If the stock closed at $105 on Saturday, the new calculation would be: ($102 + $101 + $103 + $104 + $105) ÷ 5 = $103. This is why it's called a "moving" average—the window of data continuously shifts forward in time.
Different time periods reveal different information. A 10-day SMA responds more quickly to recent price changes than a 50-day SMA. The 50-day moving average is often used to identify intermediate trends, while the 200-day moving average is considered a major trend indicator for longer-term investors. Many traders use multiple SMAs simultaneously—a short-term one and a long-term one—to spot when trends are shifting.
SMAs have limitations worth noting. They give equal weight to all prices in the period, even older ones. This means old prices influence the average just as much as recent prices, which some traders view as a drawback when markets are changing rapidly.
Practical Takeaway: An SMA calculation is simple arithmetic—add closing prices and divide by the number of periods. The strength of this method lies in its simplicity and reliability, though it treats all prices equally regardless of when they occurred.
Exponential Moving Average (EMA) and How It Differs
The Exponential Moving Average, or EMA, is a variation that places greater weight on recent prices while still considering older prices. This makes it more responsive to price changes than a Simple Moving Average. Many active traders prefer EMAs because they react faster to market movements.
The EMA calculation is more complex than the SMA. The formula involves three main components: the current price, the previous EMA value, and a multiplier called the "smoothing factor." The smoothing factor is calculated as 2 ÷ (N + 1), where N is the number of periods. For a 10-day EMA, the smoothing factor would be 2 ÷ (10 + 1) = 0.1818, or approximately 18.18%.
Here's a simplified example of how an EMA updates. Assume a 10-day EMA was previously $102, and today's closing price is $105. Using the smoothing factor of 0.1818:
- New EMA = ($105 × 0.1818) + ($102 × (1 - 0.1818))
- New EMA = $19.09 + $83.54
- New EMA = $102.63
Notice that the EMA is closer to today's price ($105) than the simple average would be, because it weights recent data more heavily. For a 50-day EMA, the smoothing factor is smaller (2 ÷ 51 = 0.0392), meaning older prices have more influence. For a 12-day EMA, the smoothing factor is larger (2 ÷ 13 = 0.1538), making it more sensitive to recent changes.
In practice, the difference between an SMA and EMA becomes visible when prices move sharply. If a stock suddenly jumps in price, the EMA will start tracking the new level sooner than an SMA. This responsiveness makes EMAs popular for short-term traders who need to spot direction changes quickly. However, faster response also means EMAs can be prone to false signals during choppy, sideways markets.
Practical Takeaway: An EMA calculation weights recent prices more heavily than older prices, making it respond faster to price changes. The smoothing factor (2 ÷ N + 1) determines how much weight recent prices receive compared to historical data.
Using Moving Averages to Identify Trends and Crossovers
Moving averages become most useful when you use them to spot trends and predict potential turning points. One of the most common strategies involves watching for crossovers, where a faster-moving average crosses above or below a slower-moving average.
A "bullish crossover" or "golden cross" occurs when a shorter-term moving average (like a 50-day EMA) crosses above a longer-term moving average (like a 200-day SMA). Historically, this has been interpreted as a potential signal for an uptrend. In the stock market, when the S&P 500's 50-day moving average crossed above its 200-day moving average in early 2019, the index subsequently gained approximately 25% over the following year, supporting the traditional bullish interpretation of this signal.
Conversely, a "bearish crossover" or "death cross" occurs when a shorter-term moving average crosses below a longer-term moving average. This may signal potential weakness. When the S&P 500's 50-day moving average fell below its 200-day moving average in February 2020, it preceded a sharp market decline, though the decline was primarily driven by pandemic-related events rather than the technical signal alone.
Beyond crossovers, traders observe how prices interact with moving averages themselves. When a price is consistently above its 50-day moving average and that 50-day average is above the 200-day average, an uptrend is typically considered to be in place. When price falls below the 50-day moving average multiple times, it may indicate weakening momentum. Some traders use moving averages as dynamic support and resistance levels—prices tend to bounce off these moving average lines during trending markets.
It's important to note that moving averages work better in trending markets and can generate false signals in sideways or choppy markets. Additionally, moving averages
Related Guides
More guides on the way
Browse our full collection of free guides on topics that matter.
Browse All Guides →