In short
- A moving average is the average of the last N closes; every close in it is from the past, so it always comes behind price.
- A simple moving average weights every close the same (1 ÷ N), while an exponential moving average gives the newest closes more weight and turns sooner.
- The closes inside an SMA are on average (N − 1) ÷ 2 candles old: 9.5 candles for a 20-period SMA, which is why crossovers come after the move has started.
- Use the slope and side of an average only to choose the direction, take entries and stops from structure, and treat a flat average as no trend.
- Example: four crossover trades stopped out in a gold range, each with a 12.00 USD stop and our 0.50 USD round trip, lose about 4.17 R before slippage.
In lesson 33 you learned that a candlestick pattern describes closed candles and is not a forecast. After this lesson you will be able to calculate a simple moving average by hand, explain why every average comes late, and use one as a filter that tells you which side to trade, while the entry still comes from structure and zones.
The idea in plain words
A moving average is the average of the last N closing prices, recalculated at every new candle. It smooths the small ups and downs, so the direction is easier to see.
The average is "moving" because the window moves: when a new candle closes, its close joins the average and the oldest close leaves it. Every number in the average is from the past, so the line always comes behind price. The MetaTrader 5 help says it plainly: the moving average is not designed to provide entrance into the market right in its lowest point.
Remember from lesson 3 that MetaTrader 5 draws candles from the bid, so an average of closes on your chart is an average of bid closes.
SMA and EMA: how each is calculated
Simple moving average (SMA). The MetaTrader 5 help gives the formula SMA = SUM (CLOSE (i), N) / N: add the last N closes and divide by N. Every close in the window counts the same, 1 ÷ N of the result: 5% for a 20-period SMA and 0.5% for a 200-period SMA.
Exponential moving average (EMA). The help gives EMA = CLOSE × P + previous EMA × (1 − P), where P is the share given to the newest close. In its words, with exponentially smoothed moving averages, the latest close prices are of more value. So an EMA turns sooner than an SMA of the same period, and it also reacts more to a single noisy candle.
The period. N counts candles on your chart, not days: a 50-period average on a 1-hour chart covers 50 hourly closes. Settings such as 20, 50 and 200 are habits that traders share, not proven numbers. No period works best in every market and year.
Lag and crossovers
Lag. The closes inside an SMA are on average (N − 1) ÷ 2 candles old. For a 20-period SMA that is (20 − 1) ÷ 2 = 9.5 candles, for a 200-period SMA 99.5 candles. A longer average is smoother but later.
Price crossing the average. The MetaTrader 5 help calls a rise above the average a buy signal and a fall below it a sell signal. Inside a range (lesson 30) price crosses a flat average again and again, so each cross is a new signal and most of them go nowhere.
Two averages crossing. The help notes that double moving averages are often used: a crossover is the moment a shorter average crosses a longer one, for example 20 above 50. The shorter one turns sooner because its closes are newer (9.5 candles old on average for 20, 24.5 for 50), but both lines lag, so the cross comes after the move has already started, and in a range it repeats as often as single crosses do.
Using an average as a filter
A filter answers one question: which side may I trade? It does not say when.
- Slope: compare the average now with an earlier value, for example five candles ago. Higher means rising, lower means falling. Fix a flat threshold in advance, in price units; the round-trip cost is only an example minimum, and a larger value filters out more noise.
- Side: a rising average with price above it allows only buys; a falling average with price below it allows only sells.
- Agreement: the market state from lesson 30 must say the same. If the average is flat, or price keeps crossing it, treat the market as a range or unclear and use the range playbook or skip.
- Entry and stop: still from structure. A buy is a pullback that holds above the last higher low, with the stop below that low, never below the line itself, because price crosses the line often.
Worked example
Example: gold on a 1-hour chart near the price level in our data (last daily close 4,406.15 on 7 September 2026), traded at 0.01 lot, where a 1.00 move is worth 1 USD. The closes are invented for teaching.
- SMA of five closes: 4,400.00, 4,402.00, 4,401.00, 4,404.00 and 4,403.00. Sum = 22,010.00, and 22,010.00 ÷ 5 = 4,402.00.
- A fast candle: the next close is 4,418.00, 15.00 above the last close. The oldest close, 4,400.00, leaves the window. New sum = 22,028.00, and 22,028.00 ÷ 5 = 4,405.60. The SMA rose only 3.60, that is (4,418.00 − 4,400.00) ÷ 5. Price moved 15.00; the average moved less than a quarter of that.
- The EMA on the same candle: Example: P is one third (a choice for teaching; the platform sets it from the period) and the previous EMA is 4,402.00. EMA = 4,418.00 × 1/3 + 4,402.00 × 2/3 = about 4,407.33. It rose about 5.33: sooner than the SMA, still well behind price.
- A filtered trade: the 50-period average is higher than five candles ago, so it is rising, price is above it and structure shows higher highs and higher lows. A pullback holds above the last higher low, and you buy with a 12.00 USD stop below that low. 1 R is the planned risk between entry and stop, set before the trade: 12.00 USD.
- Results with costs: our broker's measured round trip in 2026 is 0.50 USD at 0.01 lot. At a 2 R target (24.00 USD away) a win is 24.00 − 0.50 = 23.50 USD, so 23.50 ÷ 12.00 = about +1.96 R. If the stop fills exactly at its price, a loss is 12.00 + 0.50 = 12.50 USD, so 12.50 ÷ 12.00 = about −1.04 R; slippage or a gap can make it much worse. Break-even: 12.50 ÷ (23.50 + 12.50) = 12.50 ÷ 36.00 = about 34.7%.
- Crossovers in a range: Example: the averages cross four times in a flat range and each crossover trade, with the same 12.00 USD stop, is stopped out at its price. Loss = 4 × 12.50 = 50.00 USD, and 50.00 ÷ 12.00 = about 4.17 R before slippage. A flat average would have told you: no trend trades here.
Common mistakes
- Treating a cross as an entry. A cross comes after the move has started and repeats in ranges. Use the average for the side, and take entries from structure and zones.
- Hunting for the perfect period. Testing settings until one looks good on a past chart only fits that chart. The FCA warns that the timeframe or data shown may be selected to support a particular viewpoint rather than provide the full picture. Fix the period in advance and keep it.
- Stop just beyond the line. Price crosses an average often, so a stop there is hit by normal noise. Place it beyond the swing, as in lesson 14.
- Ignoring a flat average. A flat line with price on both sides means no direction. The FCA also reminds you that past performance is not a reliable indicator of future performance; an average only describes past closes.
Exercise
On paper, take six 1-hour gold closes: 4,410.00, 4,414.00, 4,412.00, 4,418.00, 4,420.00 and 4,424.00. Calculate the 5-period SMA at the fifth and the sixth close, say whether it is rising, and decide which side the filter allows.
Solution: at the fifth close the sum is 4,410.00 + 4,414.00 + 4,412.00 + 4,418.00 + 4,420.00 = 22,074.00, so the SMA is 22,074.00 ÷ 5 = 4,414.80. At the sixth close 4,410.00 leaves and 4,424.00 joins: 22,088.00 ÷ 5 = 4,417.60. The SMA rose 2.80 USD in one candle, more than a 0.50 USD example threshold, so it is rising (on a real chart, compare with five candles back), and the last close of 4,424.00 is above it. Decision: buys only, and only if structure also shows higher highs and higher lows; wait for a pullback for the entry.
Quick quiz
- The closes inside a 50-period SMA are on average how many candles old? Answer: (50 − 1) ÷ 2 = 24.5 candles. That is why a 50-period average turns late.
- On a 10-period SMA, the new close is 20.00 above the close that leaves the window. How much does the SMA change? Answer: 20.00 ÷ 10 = 2.00 USD up, however far price itself moved since the previous candle.
- Three crossover trades on gold at 0.01 lot each use an 8.00 USD stop and each is stopped out at its price. What is the total loss in R? Answer: each loss is 8.00 + 0.50 = 8.50 USD; three are 25.50 USD, and 25.50 ÷ 8.00 = about 3.19 R, before slippage.
Summary
A moving average is the average of past closes, so it always comes late; an EMA weights the newest closes more and turns sooner. Periods such as 20, 50 and 200 are habits, not proven settings. Use the slope and the side of the average to choose the direction, and take entries and stops from structure. Crossovers are late and repeat in ranges, so they are not entries. The next lesson covers RSI, MACD and Bollinger Bands and what they really measure.
Questions
Which moving average period is the best?
None works best in every market and year. Settings such as 20, 50 and 200 are shared habits, not proven numbers. Choose one in advance, keep it, and judge it by results in R with costs, not by how a past chart looks.
Should I buy when the 20 average crosses above the 50 average?
A crossover comes after the move has started, because both averages are built from past closes, and in a range it repeats again and again. Use it at most as a sign of direction, and take the entry and stop from structure.
Is EMA better than SMA?
Neither is better. An EMA gives the newest closes more weight, so it turns sooner but also reacts more to a single noisy candle; an SMA is smoother but later. Pick one, keep it fixed and use it as a filter.
Sources
- Moving Average - MetaTrader 5 Help — MetaQuotes
- Understanding price graphs — Financial Conduct Authority
Written and reviewed by AI agents (Claude and Gemini models) under rules set by the owner; no person reviews each text. Last AI review: 6 Nov 2026. Sources are listed at the end of the article.