YoForex AI educational guides

EMA vs SMA: Moving Average Formulas, Lag and Crossover Limits

EMA vs SMA compares two moving averages. A simple moving average (SMA) is the mean of the last N closing prices, with every close weighted equally. An exponential moving average (EMA) gives more weight to recent closes, so it turns sooner after price changes. Neither average predicts price, and an EMA crossover is a rule to test.

Published · Updated · By YoForex AI Editorial Team

EMA vs SMA: how are the two formulas different?

A simple moving average and an exponential moving average both summarize recent closing prices. MetaQuotes describes its Moving Average indicator as showing the mean instrument price value for a certain period of time, and the same indicator offers both types. The practical difference is the weight each close receives inside the average.

In a simple moving average, all prices in the period are equal in value. For an N-period SMA, you add the last N closes and divide the total by N. Each close counts for one Nth of the result, whether it happened yesterday or N periods ago.

The exponential average is recursive. The MetaQuotes Moving Average help page gives the formula as EMA = CLOSE(i) × P + EMA(i − 1) × (1 − P). In MetaQuotes' words, P is “the percentage of using the price value.” The newest close enters at that percentage, and the previous EMA carries the rest. Many guides call P the smoothing factor, but that is a common name, not the MetaQuotes term. The previous EMA already contains earlier prices, so older closes never drop out in one step. Their influence shrinks with each new bar.

The same MetaQuotes page uses P without giving a value for it, so this guide does not assume one. Check how your platform sets P before you compare an EMA on one chart with an EMA on another. A change in P changes how fast the average reacts, even when the period label stays the same.

Diagram comparing how an SMA and an EMA weight the last five closing prices. The left panel shows an SMA with equal weight on each close, labelled as 1 divided by N, and the SMA formula as the mean of N closes. The right panel shows an EMA with the newest close given the largest weight, older closes given smaller weights, and the EMA formula with the weight P on the latest price. A caption notes the figures are illustrative.
How each average weights recent closes. Illustrative weights, not market data. Swipe sideways to see the whole diagram.Open full-size diagram

How do EMA and SMA differ on the same prices? (hypothetical example)

The example below uses five made-up closing prices: 100, 102, 101, 105 and 108. These are hypothetical numbers, not a real instrument. It compares a three-period SMA with an EMA where P is set to 0.5, a value chosen only to keep the arithmetic simple. The EMA starts from the first close. A platform may start the calculation differently, so check yours. The starting value affects the early results and fades over time.

Hypothetical example: three-period SMA and EMA with P equal to 0.5 on five made-up closing prices
DayCloseSMA(3)EMA (P = 0.5)
Day 1100.00not yet defined100.00 (starting value)
Day 2102.00not yet defined101.00
Day 3101.00101.00101.00
Day 4105.00102.67103.00
Day 5108.00104.67105.50

On day 4, the SMA is the mean of 102, 101 and 105, which is 102.67. The EMA is 103.00, because the 105 close receives half the weight and the previous EMA receives the other half. On day 5, the SMA is 104.67 and the EMA is 105.50. The gap widened because the EMA moved toward the newest closes faster than the equal-weighted average did.

Neither result is more accurate than the other. Both averages describe the same five closes with different weights. The question is which weighting suits the rule you want to write.

Which average reacts faster to price changes?

MetaQuotes says that in exponential smoothing the latest close prices are of more value, and that a linear weighted average also gives more value to recent data. Because recent prices carry more weight, the EMA turns sooner after price changes direction. The SMA turns later, because a close from the start of its window counts as much as the newest close. That lag is a property of the calculation, not a sign that the market is delayed.

Comparison of a simple moving average and an exponential moving average on weighting, reaction and typical use
FeatureSimple moving average (SMA)Exponential moving average (EMA)
WeightingEvery close in the window is equal in value.The latest closes carry the most value, and older weights decline step by step.
FormulaMean of the last N closes.EMA = CLOSE(i) × P + EMA(i − 1) × (1 − P).
After a sharp moveTurns more slowly, because the whole window must change.Turns sooner, because the newest close has more influence.
Typical useA steady reference level for trend context.A reference that responds faster, often used as a trend filter.

A faster average is not a better signal. It also reacts more to short noise, which can be useful in a strong trend and costly in a range. Choose the average for the job the rule needs it to do.

When do traders use an SMA, an EMA or both?

Traders use both as a reference for trend context. Some traders read a price above an upward-sloping average as a bullish context, and the reverse as bearish; treat that as a convention to test. That is a description of how a reading is framed. It is not a proven edge, and it does not say how far price will move.

You might choose the SMA when you want a steadier reference, and the EMA when you want the reference to respond sooner. No rule makes one type better in every market. The period often matters as much as the type. The period is a setting you test on your own pair and timeframe, not a fixed rule.

If an Expert Advisor uses a moving average filter, its rules should state both the type and the period. Ask for both before you accept its entry logic. The EA evaluation guide lists the questions to ask about any automated strategy, and the forex expert advisor guide explains what an EA can and cannot do with rules like these.

What is an EMA crossover strategy?

An EMA crossover strategy uses two exponential averages with different periods, usually a faster one and a slower one. One version of the rule enters a long position when the faster average crosses above the slower one, and a short position when it crosses below. The same logic can be built with SMAs. A crossover is a rule you can write, test and reject. It does not mark a turning point by itself.

To write the rule so that it can be tested, define each part before you look at the results:

  1. The two periods, the average type for each, and the value of P or how your platform sets it.
  2. The exact cross condition, such as a cross measured on closed bars only.
  3. The entry price, the stop-loss placement, and the exit condition.
  4. The position size, and the spread and commission assumptions used in the test.

The MACD indicator guide covers a related crossover approach, and the SuperTrend guide covers a trend-following indicator that many traders compare with moving averages. Read them to see how other crossover-style rules are framed.

What can an EMA or SMA crossover not tell you?

A moving average crossover has clear limits, and most of them come from the calculation itself:

  • It confirms after the move starts. The averages change only after new closes arrive, so the cross comes after some of the move has already happened.
  • It can produce many false crosses. In a sideways range the two averages can cross repeatedly, and each cross can become a losing trade.
  • It does not set a target. A cross gives a direction at most. It does not say how far price will travel, where the stop belongs, or whether the reward is worth the risk.
  • The chosen periods are a fit to the past. If you choose the periods after looking at historical results, the test measures the fit as well as the rule.
  • Costs change the result. Spread, commission and swap can turn a small average gain into a loss, and they differ by broker and account.

A forward test on a demo or paper record shows how the rule behaves on data it did not see when you chose the periods. The paper trading guide explains what that kind of record can and cannot show.

How should you test an EMA or SMA rule?

Write the periods, the cross rule, the exit and the position size before you open the Strategy Tester. Test on a historical period that you did not use to choose the periods. Keep the rule unchanged during the test, and record each trade, including the losing ones. A clean historical run is a starting point for a forward test. It is not evidence of what the rule will do next.

Risk warning. You can lose more than you deposit, depending on your broker and country. Forex trades can use leverage, which can make losses grow quickly. A moving average crossover can produce a run of losing trades in a sideways market, and a backtest cannot promise the next result. Check the rules that apply to you with your own regulator.

Key takeaways

  • An SMA is the mean of the last N closes, with every close weighted equally.
  • An EMA weights recent closes more, so it turns sooner after a price change, at the cost of more reaction to noise.
  • The EMA formula uses P, which MetaQuotes describes as the percentage of using the price value. Check how your platform sets it before comparing averages.
  • An EMA crossover is a rule to test. It has lag, false signals and no built-in target or stop.
  • Choose the type and period from a reason you can state, then test forward with costs included.

Frequently asked questions

Is EMA better than SMA?

Neither is better in general. The EMA responds faster because it weights recent closes more. The SMA gives every close in its window the same weight. Which one suits a rule depends on the market, the period and what you want the reference to do.

Should I use an SMA or an EMA for trend context?

Either can serve as a trend reference. Use the SMA when you want a steadier line and the EMA when you want a line that turns sooner. Whichever you choose, state the period and test it on your own pair and timeframe.

What is the difference between EMA and SMA on MT5?

The MetaQuotes Moving Average help page describes four types of moving average: simple, exponential, smoothed and linear weighted. In MQL5 code, the iMA function reference takes a ma_period parameter for the averaging period and an ma_method parameter for the smoothing type. Check the method and the period in your own indicator settings before you read a chart or review an EA.

Does an EMA crossover strategy work?

There is no general answer. A crossover can be profitable in some periods and loss-making in others, and results depend on the rules, the costs and the market. Test the rule forward, with costs included, before you rely on it.

Which period should I use for a moving average?

No period is correct for every market. Pick a period for a reason you can state, such as matching the timeframe you trade, and avoid choosing it because it produced the best past result. Then test it forward.

Sources and verification

Primary-source links used for the platform behavior and risk statements in this guide. Sources reviewed 9 November 2026.

  1. MetaQuotes: Moving Average · Reviewed
  2. MetaQuotes: iMA · Reviewed