Chapter 5
Introduction to Moving Averages

"In the short run, the market is a voting machine, but in the long run, it is a weighing machine."
— Benjamin Graham

Imagine you’re sailing across the ocean.

The water is constantly shifting — waves rise and fall, winds change direction, storms appear and vanish. If you only focus on each wave, you’ll be tossed around with no clear sense of direction. But if you watch the broader movement of the sea, you can spot the underlying current carrying you forward.

In the stock market, prices behave much the same way. Day-to-day movements are noisy and unpredictable. Some days, prices surge without clear reasons. Other days, they fall just as quickly. If you react to every little movement, you risk getting lost — or worse, making emotional, costly decisions.

This is where moving averages come in.

A moving average is like a navigator’s chart. It smooths out the daily chaos and reveals the broader trend underneath. By averaging past prices, it helps traders see whether the market is generally rising, falling, or simply drifting sideways. Moving averages don’t predict the future — but they make the present much clearer.

Throughout history, moving averages have been one of the most enduring and widely used tools in trading. From simple 50-day and 200-day averages that investors have relied on for decades, to more modern, adaptive variations, moving averages offer a simple yet powerful lens for interpreting price action.

In this chapter, we’ll explore the foundations of moving averages — starting with the Simple Moving Average (SMA), then moving to the Exponential Moving Average (EMA), and finally comparing how the two behave in different market conditions. Understanding these basics will give you one of the most important tools for building reliable, data-driven trading strategies.

5.1 What is a moving average?

A moving average is a statistical calculation used to analyze data points by creating a series of averages of different subsets of the full data set. In trading and finance, it is most commonly applied to stock prices to help smooth out short-term fluctuations and highlight longer-term trends.

Instead of focusing on each day’s closing price, a moving average takes a defined number of past data points—such as 10, 20, or 200 days—and calculates their average. As each new day arrives, the oldest data point is removed, the newest is added, and the average "moves" forward in time.

The result is a line that flows across the price chart, filtering out day-to-day noise and revealing the underlying trend. When prices are erratic or choppy, a moving average helps traders step back and assess whether the broader movement is up, down, or sideways.

There are multiple types of moving averages, each with different formulas and sensitivities to recent price changes. Despite their differences, they all serve the same core purpose: to provide clarity in a market full of volatility and noise.

Moving averages are foundational to technical analysis. They are used not only to observe trends, but also to generate trading signals, define support and resistance levels, and form the basis for more advanced indicators such as MACD and Bollinger Bands.

In the following sections, we’ll explore the two most widely used types of moving averages—Simple Moving Average (SMA) and Exponential Moving Average (EMA)—and discuss their characteristics, strengths, and limitations.

5.2 Simple Moving Average (SMA) explained

The Simple Moving Average (SMA) is the most straightforward form of a moving average. It is calculated by taking the arithmetic mean of a given number of recent data points, typically closing prices.

Formula

Given a series of closing prices P1,P2,…,Pn over n time periods, the SMA is calculated as:

         P1 + P2 + ⋅⋅⋅ + Pn
SMAn  =  -------------------
                 n

Each time a new data point is added, the oldest one is removed, and the average "moves" forward in time.

Example

Suppose we have the following 5-day closing prices: $100, $102, $101, $105, $107

The 5-day SMA would be:

         100-+-102-+-101-+--105 +-107    515-
SMA5   =               5              =   5  = 103

On the next day, if the new closing price is $110, the SMA will be updated by removing $100 and adding $110:

SMA    = 102-+-101-+-105-+--107 +-110 =  525-= 105
     5                 5                  5

Extending the Example

Let’s continue the example by adding yet another day’s closing price. After the sixth day ($110), suppose the seventh day’s closing price is $108.

To compute the new 5-day SMA, we now drop the oldest value ($102) and include the newest ($108):

        101 + 105 +  107 + 110 + 108    531
SMA5  = ---------------------------- =  ----= 106.2
                      5                  5

Rolling SMA Values

Day Closing Price SMA Calculation SMA Value
Day 5 $107 (100 + 102 + 101 + 105 + 107)/5 103.0
Day 6 $110 (102 + 101 + 105 + 107 + 110)/5 105.0
Day 7 $108 (101 + 105 + 107 + 110 + 108)/5 106.2

This rolling update mechanism is what gives the simple moving average its characteristic "lagging" behavior—it reacts slowly to new data because each point is weighted equally.

Trading Significance

PIC

The SMA helps traders identify the overall direction of a stock’s price trend. Commonly used SMA lengths include:

  • Short-term SMA (e.g., 10-day, 20-day): Useful for capturing recent momentum.
  • Medium-term SMA (e.g., 50-day): Often used to gauge intermediate trends.
  • Long-term SMA (e.g., 200-day): Tracks broader market sentiment and is widely used to identify bull or bear markets.

Crossovers involving SMAs—such as the price crossing above or below the SMA, or a short-term SMA crossing a long-term one—are commonly used as trading signals. For example, a "golden cross" occurs when a short-term SMA (e.g., 50-day) crosses above a long-term SMA (e.g., 200-day), often interpreted as a bullish signal.

Limitations

The SMA treats all data points equally, regardless of how recent they are. This can be a drawback in fast-moving markets where recent price changes carry more weight. In such cases, traders may prefer the Exponential Moving Average (EMA), which gives more importance to recent data—a topic we’ll explore in the next section.

5.3 Exponential Moving Average (EMA) explained

The Exponential Moving Average (EMA) is a type of moving average that places greater weight on more recent data points. This makes it more responsive to new information compared to the Simple Moving Average (SMA), which treats all observations equally.

Why Use EMA?

In fast-moving markets, traders often prefer the EMA because it reacts more quickly to price changes. This can be particularly useful when identifying short-term trends or potential reversals.

Formula

The EMA is calculated using a recursive formula:

EMA   =  α ⋅ P + (1 − α ) ⋅ EMA
     t       t                t−1

Where:

  • Pt is the current price
  • EMAt1 is the EMA value from the previous period
  • α is the smoothing factor, calculated as α = -2--
n+1, where n is the length of the EMA

Unlike the SMA, which requires a full window of past prices to compute a single average, the EMA starts with an SMA as the initial value and builds recursively from there.

Example

Suppose we want to calculate a 5-day EMA and we are given the following closing prices:

Prices: 100, 102, 101, 105, 107

First, calculate the 5-day SMA as the initial EMA value:

         100-+-102-+-101-+-105-+-107-
SMA5  =               5              =  103

Now, assume the next closing price (Day 6) is $110. The smoothing factor for a 5-day EMA is:

     --2--   1-
α =  5 + 1 = 3 ≈  0.333

The EMA for Day 6 is:

EMA    = 0.333 ⋅ 110 + (1 − 0.333 ) ⋅ 103 = 36.63 + 68.91 = 105.54
     6

If Day 7’s price is $108, we repeat the calculation:

EMA7  =  0.333 ⋅ 108 + 0.667 ⋅ 105.54 = 35.964 + 70.36 =  106.32

Comparison with SMA

  • Responsiveness: EMA reacts faster to price changes.
  • Lag: EMA has less lag than SMA, making it more useful for detecting short-term trends.
  • Weighting: EMA emphasizes recent prices more, while SMA treats all data points equally.

Trading Applications

PIC

EMAs are widely used in momentum strategies and are often paired with other EMAs of different periods to form crossover systems. For example:

  • A short-term EMA (e.g., 12-day) crossing above a longer-term EMA (e.g., 26-day) may signal a bullish trend.
  • The popular MACD indicator is based entirely on the difference between two EMAs.

The EMA’s ability to balance responsiveness and smoothness makes it a favorite among technical traders who need timely yet stable trend signals.

5.4 Comparing SMA and EMA: Pros and Cons

Both the Simple Moving Average (SMA) and the Exponential Moving Average (EMA) are essential tools in technical analysis. While they serve similar purposes—smoothing out price data and highlighting trends—they behave differently and are suited to different trading objectives.

Responsiveness

  • SMA: Responds to price changes at a steady rate because it gives equal weight to all data points in the window.
  • EMA: Places more weight on recent prices, making it faster to react to new price movements for the same window length.

However, it’s important to note that window size matters significantly. A short-period SMA (e.g., 5-day SMA) can be more responsive than a long-period EMA (e.g., 30-day EMA). Responsiveness depends on both the type of moving average and the number of periods chosen.

Summary: EMA is generally faster than SMA if you are comparing the same number of periods, but shorter windows — regardless of SMA or EMA — will always respond more quickly to price changes.

Smoothness

  • SMA: Tends to be smoother and less prone to false signals in choppy markets.
  • EMA: Can be more erratic due to its sensitivity to recent data, which may lead to whipsaws in sideways markets.

Calculation Complexity

  • SMA: Easy to calculate and interpret; simply the arithmetic mean over a given period.
  • EMA: Involves a recursive formula with a smoothing factor, requiring more computation but providing better adaptability.

Use Cases

  • SMA: Often used for identifying major support/resistance levels, long-term trend confirmation, and smoothing out noise.
  • EMA: Frequently used in momentum strategies, crossover systems (e.g., MACD), and short-term trading setups.

Visual Behavior

On a chart, the EMA will hug the price line more closely than the SMA. This means it picks up trend changes earlier, but also makes it more susceptible to reacting to short-term volatility.

Summary Table

Criteria SMA EMA
Weighting Method Equal Exponential
Reactivity Slower Faster
Smoothness More stable More sensitive
Ease of Calculation Simpler More complex
Best For Long-term trends Short-term signals

Which One Should You Use?

There is no universally "better" moving average—it depends on your trading strategy and timeframe. Some traders even use both: for example, a crossover system where a short-term EMA is compared with a long-term SMA.

Ultimately, understanding the strengths and weaknesses of each moving average type allows you to choose the right tool for the right job.

5.5 Other types of moving averages

While the Simple Moving Average (SMA) and Exponential Moving Average (EMA) are the most commonly used moving averages in trading, there are several other variants that offer alternative weighting schemes. These moving averages aim to better reflect market dynamics, but they are not always superior in practice.

Weighted Moving Average (WMA)

The Weighted Moving Average (WMA) assigns linearly increasing weights to more recent prices. Unlike the EMA, which uses an exponential weighting curve, the WMA uses a simpler linear model.

Formula

Given n data points P1,P2,…,Pn, the WMA is calculated as:

          ∑n
WMA     = --∑i=1-wi-⋅ Pi where  w  = i
      n        ni=1 wi            i

Here, the most recent price gets the highest weight (n), and the weight decreases linearly toward the oldest data point.

Volume-Weighted Moving Average (VWMA)

The Volume-Weighted Moving Average (VWMA) takes trading volume into account when calculating the average. It gives more influence to prices that occurred on high-volume days, under the assumption that those prices better reflect market sentiment.

Formula

Let Pi be the price and V i the volume for day i. The VWMA over n periods is defined as:

            ∑n   Pi ⋅ Vi
VWMAn    =  -∑in=1-------
                i=1 Vi

Popularity and Practical Use

Although WMA and VWMA are conceptually appealing and are sometimes used in algorithmic or institutional trading, they are not as widely adopted in mainstream technical analysis as SMA and EMA. This is partly because the additional complexity rarely translates into significantly better results.

A Data-Driven Perspective

In a data-driven trading environment, it’s important to remember that "more specialized" does not necessarily mean "better." According to empirical testing and practical experience, the EMA often performs best among moving averages. Its balance between responsiveness and stability makes it highly effective for a wide range of strategies.

For most traders, mastering EMA and SMA provides more than enough analytical power. Specialized variants like WMA and VWMA may offer marginal improvements in specific scenarios, but they are best explored after developing a strong foundation with the core techniques.

We’ve now explored the major types of moving averages. But theory only goes so far. The real question is: which one works best in practice? That’s a question we’ll answer through systematic backtesting on SPY data.