Moving averages explained

BEGINNER·15 min read·Reviewed 16 October 2026·Technical Analysis

What you will learn

  • What a moving average is, and how to calculate a simple moving average (SMA) and an exponential moving average (EMA) by hand.
  • Why every moving average lags price, by how much, and what that means for how you use it.
  • How crossovers and the 20/50/100/200 “stack” are read, and what a golden cross and a death cross are.
  • What academic tests and our own test of crossover rules on five instruments show, including the parts that do not flatter the method.

The idea in plain words

Price is jumpy. A single candle can spike and reverse, which makes it hard to see the direction underneath. A moving average smooths the jumpiness by replacing each price with the average of the last few prices. As new candles arrive, the oldest drops out and the newest comes in, so the average “moves” along the chart.

Think of the temperature. Today might be unusually cold, but the average of the last 20 days tells you what season you are in. A moving average does the same for price: it answers “where has price been, on average, lately?” and, by whether price sits above or below it, “is price high or low compared with recent history?”

The price you pay for smoothness is delay. An average of the last 20 candles cannot know that the market turned two candles ago. It always arrives late, and this single fact explains almost everything about how moving averages behave, including their strengths and their weaknesses.

How it works

The simple moving average (SMA)

The simple moving average of length n is the plain average of the last n closing prices:

SMA = (close₁ + close₂ + … + close_n) ÷ n

where close₁ is the most recent close, and n is the period (for example 20). Every price in the window has equal weight, and a price from n candles ago drops out completely when a new candle arrives.

The exponential moving average (EMA)

The exponential moving average gives more weight to recent prices. It is calculated step by step:

EMA(today) = EMA(yesterday) + α × (close today − EMA(yesterday))

where α (alpha) is the smoothing factor, α = 2 ÷ (n + 1). For n = 5, α = 2 ÷ 6 = 1/3, so each new close moves the EMA by one third of the gap between the close and the previous EMA. Older prices never fully disappear, they just count for less and less. The EMA needs a starting value. Our analysis engine seeds it with the SMA of the first n closes, a common convention; other platforms start it differently, so the first values of an EMA can differ between platforms and settle toward the same numbers later.

Why they lag, and by how much

Both averages lag price. On a market that moves in a perfectly straight line, an SMA of length n lags by (n − 1) ÷ 2 candles, and an EMA with α = 2 ÷ (n + 1) lags by the same amount. We confirmed this numerically with the engine: a 10-period average trailed a straight line by 4.5 candles, a 20-period average by 9.5 and a 50-period average by 24.5, for both the SMA and the EMA. The EMA is not “faster” on average on a straight line. What differs is the shape of the weighting: the EMA reacts more to the newest candles and also remembers old ones for longer, so it turns a little sooner after a sharp move and reacts more to a single spike.

The consequence is simple. A longer period smooths more and lags more. A shorter period follows price closely and gives more false turns. There is no setting that is both smooth and fast.

How moving averages are used

  1. Trend direction. If price is above a rising moving average, traders read the trend as up. If it is below a falling one, as down.
  2. Crossovers. A crossover is when a fast average (short period) crosses a slow average (long period). A fast average crossing above a slow one is read as bullish, below as bearish. A golden cross is the 50-period average crossing above the 200-period, and a death cross is the reverse. They are names for particular crossovers, with no extra meaning in the mathematics.
  3. Stack. When the 20, 50, 100 and 200-period averages are in order (20 above 50 above 100 above 200, or the reverse), the averages are said to be stacked. Our engine records whether the EMAs are stacked bullish, stacked bearish or mixed.
  4. Dynamic levels. Traders watch whether price pauses near a moving average, treating it like a moving support or resistance. We did not find a rigorous test of that idea, so treat it as something to check yourself.

What the research says

  • Brock, Lakonishok and LeBaron (Journal of Finance, 1992) tested two simple rules, moving-average crossovers and trading-range breaks, on the Dow Jones Index from 1897 to 1986, using bootstrap techniques. They report strong support for the rules: buy signals earned higher returns than sell signals, and the results were not consistent with four standard models of random price movement.
  • Sullivan, Timmermann and White (Journal of Finance, 1999) revisited that study. They expanded the 26 rules to a much larger universe, used 100 years of Dow data, and applied White’s Reality Check, a method that adjusts for data snooping: the risk that if you try enough rules, some will look good by luck. Whether a rule survives that adjustment is the key question for any test.
  • Park and Irwin (Journal of Economic Surveys, 2007) surveyed the evidence: of 95 modern studies, 56 found positive results for technical strategies, 20 negative and 19 mixed. They warned that many studies suffer from data snooping, rules chosen after the fact, and difficulties in estimating risk and transaction costs.
  • Wong, Manzur and Chew (Applied Financial Economics, 2003) tested moving average and RSI rules on Singapore data and report significantly positive returns.
  • Moskowitz, Ooi and Pedersen (Journal of Financial Economics, 2012) found trend persistence of one to twelve months across 58 futures, as covered in the trends lesson.

The honest reading: some well-designed tests find that moving-average rules worked in some markets and periods, and the evidence is mixed once you account for data snooping and costs. A rule that worked on a century of stock-index data is not a promise about a forex pair today.

Our own test, and its limits

We tested two fixed, conventional crossover rules on daily candles of five instruments from the demo feed we use, with the rules chosen in advance and never tuned: the 50/200 SMA and the 20/50 SMA. Each rule was always in the market: long when the fast average was above the slow one, short when below. The signal was taken at the close and the trade entered at the next day’s open. We charged an assumed cost at each reversal (0.01% of price for the forex pairs, 0.02% for gold and 0.05% for Bitcoin; these are our assumptions, not broker quotes). The first 200 (or 50) candles are used up computing the averages.

Our own test, and its limits
Instrument 50/200 with cost Buy and hold, same period 20/50 with cost Buy and hold, same period
EUR/USD −10.4% −3.3% +12.9% −6.3%
GBP/USD −12.1% −3.0% +13.0% −5.1%
USD/JPY −7.2% +39.3% +5.0% +45.2%
XAU/USD (gold) +46.6% +133.1% +20.5% +141.7%
BTC/USD −28.0% +189.7% −40.0% +326.8%

The periods are about five years of daily candles for the forex pairs and gold (13 October 2021 to 15 October 2026 for the 50/200 rule, from March 2021 for the 20/50 rule), and about 3.6 years for Bitcoin (from March 2023 for the 50/200 rule). The 50/200 rule reversed only 7 to 12 times, the 20/50 rule 29 to 35 times.

What the table shows, and does not show:
– The two rules gave opposite answers on the same data. EUR/USD lost 10.4% under the 50/200 rule and made 12.9% under the 20/50 rule. A result that flips sign with a parameter that every trader chooses differently is a warning about how fragile it is.
– In three of the five markets (USD/JPY, gold, Bitcoin) both rules did much worse than buying and holding, a plausible reason being that in strong one-directional markets a rule that also goes short can end up on the wrong side and reverses late (we did not test the reason).
– Few trades, one feed, five to six years and a single market regime are not enough to say anything general. This is an illustration, not evidence for or against moving averages.
– The assumed costs were small against these results (at most about one percentage point), so the spread does not explain the gap to buy and hold.

Worked examples

Example 1: calculate an SMA and an EMA by hand

These are the last six 4-hour closes of EUR/USD on the demo feed, oldest first: 1.12140, 1.12070, 1.12188, 1.12124, 1.12290, 1.12451.

SMA of length 5 from the last five closes (1.12070, 1.12188, 1.12124, 1.12290, 1.12451):
1. Sum = 1.12070 + 1.12188 + 1.12124 + 1.12290 + 1.12451 = 5.61123.
2. SMA5 = 5.61123 ÷ 5 = 1.12225.

EMA of length 5, with α = 2 ÷ 6 = 1/3, using the EMA before these closes. The EMA values we get from the engine after each of the last four closes are 1.12085, 1.12098, 1.12162 and 1.12258. Check the last two steps by hand:
1. After the close 1.12290: EMA = 1.12098 + (1.12290 − 1.12098) ÷ 3 = 1.12098 + 0.00064 = 1.12162.
2. After the close 1.12451: EMA = 1.12162 + (1.12451 − 1.12162) ÷ 3 = 1.12162 + 0.00096 = 1.12258.

The last close was 1.12451. The SMA5 sits at 1.12225 (22.6 pips below it) and the EMA5 at 1.12258 (19.3 pips below it). Both lag a rising price, and the EMA, which weights the newest close more, lags a little less.

EUR/USD 4-hour candles with 5-period SMA and EMA: last close 1.12451, SMA5 1.12225 and EMA5 1.12258
What to notice: That both averages sit below a rising price and that the EMA is closer to it.

Example 2: nine real crossovers

This is the real sequence of 20/50 SMA crossovers on EUR/USD daily candles from February 2025 to October 2026, with each trade entered at the next day’s open and held until the opposite crossover (before costs):

Example 2: nine real crossovers
Signal date Direction Entry Exit Result Held
14 Feb 2025 Long 1.04846 1.16588 +1,174.2 pips 131 candles
18 Aug 2025 Short 1.16588 1.17593 −100.5 pips 15
8 Sep 2025 Long 1.17593 1.16837 −75.6 pips 28
16 Oct 2025 Short 1.16837 1.17374 −53.7 pips 40
11 Dec 2025 Long 1.17374 1.16072 −130.2 pips 61
10 Mar 2026 Short 1.16072 1.16857 −78.5 pips 32
23 Apr 2026 Long 1.16857 1.15972 −88.5 pips 29
3 Jun 2026 Short 1.15972 1.15399 +57.3 pips 49
11 Aug 2026 Long 1.15399 1.13677 −172.2 pips 34
  1. Two trades won and seven lost, a win rate of 22%.
  2. The seven losers averaged −99.9 pips (their sum is −699.2 pips).
  3. The net result over the nine trades is +532.3 pips, but all of it came from one trade, the +1,174.2-pip trend of 2025. Without it, the other eight trades lost 641.9 pips.
  4. From 28 September 2026 the rule has been short; that trade was still open on 15 October.

This is the typical shape of a trend-following rule: many small losses while the market chops sideways, and a few large gains when a trend arrives. It also shows the cost of the lag: a crossover rule enters after a move has started and exits after it has ended. A rule like this works only if you can stay with it through the string of losses, and a different period could have shown the opposite.

EUR/USD daily candles, January 2025 to October 2026, with 20 and 50 SMAs, nine crossovers and a +1,174 pip long trade in 2025
What to notice: That the averages cross repeatedly during the sideways phases.

How to apply it step by step

  1. Pick one timeframe, such as D1 or H4, and add two averages, for example 20 and 50.
  2. Write down whether price is above or below each, and whether each is rising or falling (compare it with its value 5 candles ago).
  3. Note the stack: are the averages in order, or tangled together? Tangled averages usually mean a range.
  4. Decide in advance what a crossover means to you: a signal, a filter (only trade in its direction) or just context.
  5. Measure the lag: find the last swing low or high on the chart and count how many candles passed before price crossed back over the average. That number is the cost of using it.
  6. If you want to test a crossover rule, write the rule, the cost assumption and the period before you look at results, test it on data you did not use to choose it, and count the number of trades.
  7. Compare any result with buy and hold for the same period.

Common mistakes

  • Treating a crossover as a prediction. A crossover reports that the past average of prices has changed order. It does not say what comes next.
  • Optimising the period. Trying every pair of periods and keeping the best is data snooping. The best past pair is partly luck.
  • Using crossovers in a range. In sideways markets the averages cross back and forth and every signal loses a little, as the sequence of seven losers shows.
  • Ignoring the lag. The signal comes after a move has started. Know roughly how many candles that is for your settings.
  • Assuming an EMA is better. On a straight line the lag is the same. The EMA reacts more to recent candles, which suits some uses and creates more false turns in others.
  • Comparing averages across platforms without checking the start. EMA values depend on how the average was seeded, so early values can differ.

When it works and when it does not

Moving averages work as a way of seeing the direction under noise, as a simple trend filter and as a repeatable rule you can test. They work best when the market is trending, which in our earlier measurement was around half of all candles. They work badly when the market is range-bound, because the lag makes every signal late and every reversal a small loss.

The evidence is genuinely mixed. A famous century-long test found the rules profitable, a later study set out to correct for data snooping, a large survey found most modern studies positive but warned about their weaknesses, and our own small test gave opposite answers for two common settings. The sensible stance for a beginner is to use moving averages for what they are, a smoothing of past prices, and to treat any claim of an edge as something to test with costs and fresh data. Past results of a rule are not a guide to its future results.

Practice exercise

Closes, oldest first: 10, 12, 11, 13, 15, 14.

  1. What is the SMA of length 3 at the last close?
  2. Calculate the EMA of length 3 at each of the last three closes. Use α = 2 ÷ (3 + 1) = 0.5, and start the EMA with the SMA of the first three closes.
  3. At two successive candles, a fast SMA was 98.0 then 101.0, and a slow SMA was 100.0 then 100.0. What happened?
  4. A 20-period moving average on a steadily rising market lags price by how many candles?

Answers:
1. SMA3 = (13 + 15 + 14) ÷ 3 = 14.0.
2. Start: SMA of 10, 12, 11 = 11.0. At the close 13: 11 + 0.5 × (13 − 11) = 12.0. At 15: 12 + 0.5 × (15 − 12) = 13.5. At 14: 13.5 + 0.5 × (14 − 13.5) = 13.75.
3. The fast average moved from below the slow one (98 under 100) to above it (101 over 100): a bullish crossover.
4. (20 − 1) ÷ 2 = 9.5 candles.

Key terms

Moving average – the average of the last n prices, recalculated as each new candle arrives.
SMA (simple moving average) – the equal-weighted average of the last n closes.
EMA (exponential moving average) – an average that weights recent closes more, built with EMA = previous EMA + α × (close − previous EMA).
Period (n) – the number of candles in the average.
Lag – the delay between a change in price and the same change showing in the average.
Crossover – a fast average crossing above or below a slow average.
Golden cross / death cross – the 50-period average crossing above / below the 200-period.
Data snooping – finding rules that look good by testing so many options that some work by chance.

Frequently asked questions

What is the difference between an SMA and an EMA?

An SMA gives every close in the window the same weight and drops the oldest one completely. An EMA gives more weight to recent closes and lets older ones fade gradually. On a steady trend both lag by the same amount, but the EMA reacts more to the latest candles.

Which moving average period is best?

No period has been shown to be best. Common settings are 20, 50, 100 and 200, and each is a trade-off between smoothness and lag. In our test the 20/50 and 50/200 rules gave opposite results on the same data, so the choice matters and nothing here picks a winner.

What is a golden cross and does it work?

A golden cross is when the 50-period average crosses above the 200-period. In our test the 50/200 rule lost money on four of the five instruments over five years (EUR/USD, GBP/USD, USD/JPY and Bitcoin), and made money on gold while trailing buy and hold. It is a name for a particular crossover, not a proven signal.

Do moving averages predict the market?

No. They summarise past prices, and they lag. Academic tests are mixed: some find positive results in some markets and periods, others warn that data snooping and costs weaken them.

Why do moving averages give false signals?

Because they are delayed, and a market that moves sideways makes the averages cross back and forth. In the nine EUR/USD crossovers we listed, seven lost money, and most of the damage came during sideways stretches.

Can I use a moving average as support and resistance?

Traders do, but we did not find a rigorous test of it. If you use it that way, record each time price reaches the average and what happens, as in the support and resistance lesson.

Key takeaways

  • A moving average replaces price with the average of the last n prices. It smooths noise and lags price.
  • SMA = equal-weighted average. EMA = previous EMA + α × (close − previous EMA), with α = 2 ÷ (n + 1).
  • Both lag by about (n − 1) ÷ 2 candles on a steady trend, so longer periods smooth more and lag more.
  • Crossovers describe the past, win in trends and lose in ranges, and are sensitive to the settings: in our test two common settings gave opposite results on the same data.
  • Evidence from academic tests is mixed, so test with costs and fresh data before trusting a rule.

Quick quiz

Q1. Closes 8, 10, 12. What is the SMA of length 3?
A: (8 + 10 + 12) ÷ 3 = 10.

Q2. What is α for an EMA of length 9?
A: α = 2 ÷ (9 + 1) = 0.2.

Q3. The previous EMA is 50.0 and the close is 53.0, with α = 0.2. What is the new EMA?
A: 50.0 + 0.2 × (53.0 − 50.0) = 50.6.

Q4. Why does a longer moving average give fewer false signals but later ones?
A: It averages over more candles, so it smooths more noise, but each change in price takes longer to show in it.

Q5. A 50/200 rule gains 20% and a 20/50 rule loses 10% on the same data. What does that tell you?
A: The result depends heavily on the chosen settings, so it is fragile and should not be trusted on one test.

Q6. Why is a trend-following rule often right in only a minority of its trades but can still do well?
A: It takes many small losses in sideways markets and a few large gains in trends, so a low win rate can be offset by large winners. It can also lose overall if the large winners do not come.

Going deeper

Educational content only, not financial advice. Trading involves substantial risk of loss.