How to use moving averages in trading

Bobby

Written by Bobby

How to use moving averages in trading

What is a moving average?

✅

A moving average is the average price over a given period.

We call it a "moving" average because it's recalculated with every new candle.

The calculation updates by adding the newest price and removing the oldest.

For example, a 20-period moving average calculates the average of the last 20 closing prices.

How to calculate a moving average

The calculation is simple:

  1. Choose the number of periods, for example 20
  2. Take the last X closing prices, where X is the number of periods
  3. Add those prices together
  4. Divide the result by the number of periods

Here's an example with a 5-period moving average:

  • Closing prices of the last 5 candles: 100, 102, 99, 101, 103
  • Sum: 100 + 102 + 99 + 101 + 103 = 505
  • Average: 505 / 5 = 101

The moving average value for this candle will be 101.

Different types of moving averages

There are several types of moving averages.

The most common are:

  1. Simple moving average (SMA): the one I've just explained
  2. Exponential moving average (EMA): gives more weight to recent prices

How to use moving averages in trading

1. Identify the trend

One of the most common uses of moving averages is identifying the trend.

Here's what to do:

  1. Choose a long-term moving average, for example 100 periods
  2. If price is above the moving average, the trend is bullish
  3. If price is below it, the trend is bearish
Identifying the trend

For example, on a 30-minute gold chart (XAU/USD):

  • Price is above the MA100: you favour buying, shown by the green arrow
  • Price moves below the MA100: you consider selling, shown by the red arrow

2. Moving average crossovers

Another strategy uses the crossover of two moving averages:

  1. Choose a short-term moving average, for example 20 periods
  2. Choose a long-term moving average, for example 200 periods
  3. Wait for the two moving averages to cross
Moving average crossovers

Here's how you could interpret the signals:

  • The MA20 crosses above the MA200: buy signal
  • The MA20 crosses below the MA200: sell signal
✅

This is a strategy for spotting trend changes on higher timeframes.

3. Dynamic support and resistance

Moving averages can also act as dynamic support and resistance levels:

  1. Choose a moving average suited to your timeframe, for example the MA20
  2. Watch how price reacts when it touches the moving average
  3. Use these levels to look for entries in the direction of the trend
Dynamic support and resistance levels

For example:

  • Price rises towards the MA20
  • It bounces off the moving average, indicating dynamic resistance
  • You can consider selling each time price touches the MA20 and bounces downwards
  • You can place a stop loss just above the moving average to protect against a reversal

The limits of moving averages

Moving averages are very popular, but they have their limits:

⚠️

Moving averages are lagging indicators. They're based on past data, which can produce late signals.

  • They work better in trending markets
  • They produce plenty of false signals in ranging markets
  • Like all indicators, they aren't foolproof

It's much easier than you think...

Apex Trader Funding payout received in Qonto
Bobby

Written by

Bobby

Independent trader

I'm a former financial engineer and spent seven years on trading floors and at a hedge fund. For over three years, I've been sharing my trading experience and what I know about finance.