Define the objective and acceptable losses before choosing a crossover. Compare SMA and EMA over the same dates, data treatment, execution timing, and costs.
Originally Published: · Last Reviewed:
For an SMA vs EMA crossover, compare the trades each rule produces rather than picking the faster line. EMA gives recent prices more weight, which can help during a sustained move or send you out of the market just before a rebound. The example below uses the SPDR S&P 500 ETF Trust (SPY), an exchange-traded fund. EMA traded more often in some window pairs and less often in others. Even the return ranking changed when we changed the assumed trading cost.
All sections and evidence
How to compare a rule you might use
Start with the outcome you want. If the aim is to reduce losses, look at drawdowns and time spent out of the market alongside returns. If the aim is higher returns, a smoother chart is not enough.
For example, take one row of the comparison table and test its SMA and EMA rules on the same dates, using the same price fields, cash return and next-open execution. Record gross returns first, then apply the same cost model to each. Inspect the trades and drawdowns instead of stopping at whichever compound annual growth rate (CAGR) is higher.
Test nearby window pairs to see whether a small setting change causes a large change in results. Then freeze the rule and assess it on a period you did not use to choose it. Once that later period influences another adjustment, it is no longer an untouched test.
A rule can also be hard to follow despite acceptable numbers. Consider whether you would stay with it through repeated sell-and-buy signals, a long spell in cash, or years of lagging buy-and-hold.
For taxable accounts, assess taxes separately from trading costs. Realized gains, holding periods and tax lots matter; selling at a loss and repurchasing the same ETF soon afterward can also affect whether the loss is deductible. Those effects cannot be represented by one annual fee.
Before using either rule, make sure your chart displays the same data adjustments and EMA settings as the test. The TradingView settings guide explains where platform choices enter the comparison, while the backtest guide covers rule selection and untouched-data testing.
What changes when you use EMA instead of SMA?
A simple moving average, or SMA, takes the average of the closes inside its window. Each close inside the window gets the same weight. An exponential moving average, or EMA, gives newer closes more weight while keeping a fading contribution from older prices.
Suppose prices fall sharply for three days, then recover. An EMA pair may signal a sale while the SMA pair stays invested. If the decline continues, that earlier sale can avoid further losses. If prices rebound, the EMA rule may miss the recovery and buy back at a higher price, paying for both trades.
The useful question is how much those earlier exits and entries gained or lost after costs. Counting how often they helped would miss the size of each gain or loss.
What changes when you switch from SMA to EMA
| Question | SMA | EMA |
|---|---|---|
| Price weights | Equal weight for each close inside the window | More weight for recent closes; older prices fade gradually |
| Response to a new move | May change less at first | May change more at first; a crossover is not always earlier |
| Number of trades | Depends on the pair and price path | Can be higher, lower, or the same |
| Better choice | Compare costs, returns, and losses under the same rule | Use the same test conditions; responsiveness alone is not a return advantage |
This comparison covers daily rules that switch between a US equity ETF and cash. It does not test short selling, leverage, or intraday trading.
What the SPY comparison shows
The following test holds SPY when the fast average is above the slow average and holds cash otherwise. A signal from one day’s close takes effect at the next available open. The fast average uses the shorter span, and the slow average uses the longer one. A fast/slow pair lists those spans in trading days. The six pairs are shown together, with no single pair presented as the best setting.
Each move into or out of SPY is charged an assumed 25 basis points, or 0.25%. Cash earns nothing, and taxes are excluded. This is a cost scenario, not a measured quote for trading SPY today.
Data limit: the source file runs from January 4, 2010 through December 30, 2019. Its past price-adjustment treatment is not documented well enough to label these results clean raw-price returns or verified dividend-reinvested returns. The calculations use the file’s prices as supplied, without adding separate dividend payments. These figures compare disclosed rules on one pinned file; they do not estimate a verified dividend-reinvested investor return.
Compound annual growth rate (CAGR) expresses the change in portfolio value as a yearly compound rate. Each row starts when its slow average first becomes available, so buy-and-hold also has a different start date across rows. Compare SMA and EMA within the same row.
SPY file-based comparison: position changes and annualized returns
| Fast/slow days | SMA changes | EMA changes | SMA return | EMA return | Buy-and-hold return |
|---|---|---|---|---|---|
| 5/20 | 145 | 153 | −0.17% | −0.26% | 13.84% |
| 10/30 | 81 | 95 | 3.30% | 1.71% | 13.79% |
| 20/50 | 53 | 35 | 5.54% | 6.88% | 13.24% |
| 50/100 | 19 | 11 | 8.79% | 9.76% | 14.28% |
| 50/200 | 9 | 9 | 9.23% | 9.44% | 13.93% |
| 100/200 | 7 | 9 | 9.16% | 8.94% | 13.93% |
EMA made more position changes in three pairs, fewer in two, and the same number in one. It also finished ahead of SMA in three rows and behind in three. Buy-and-hold had the higher CAGR in all six periods under these assumptions.
Buy-and-hold is the full-stock reference, not an equal-risk control. To evaluate timing rather than just reduced exposure, also compare a simpler stock-and-cash allocation on the same row’s dates and report cash interest consistently. The tables here hold cash at zero and do not include that additional control.
The 20/50 row gives a concrete comparison: EMA changed position 35 times against SMA’s 53 and earned 6.88% against 5.54% a year after the assumed costs. That tells us what these rules did on this file; it does not establish 20/50 EMA as a setting to trade.
Position changes count entries and exits, including an initial purchase when the rule starts invested. They are not completed round trips or measured whipsaws. The 50/200 rules each show nine changes: an initial entry, followed by eight switches, with the final position still invested.
Returns alone also leave out how far portfolio value fell along the way. Maximum drawdown measures the fall from a previous portfolio high to a later low.
Losses and time invested under the stated cost scenario
| Fast/slow days | SMA maximum drawdown | EMA maximum drawdown | SMA time invested | EMA time invested |
|---|---|---|---|---|
| 5/20 | −35.87% | −31.29% | 67.3% | 70.6% |
| 10/30 | −18.66% | −21.08% | 68.6% | 73.2% |
| 20/50 | −24.73% | −18.64% | 72.0% | 80.8% |
| 50/100 | −22.07% | −18.26% | 80.0% | 85.5% |
| 50/200 | −19.54% | −18.07% | 86.6% | 90.1% |
| 100/200 | −19.81% | −21.53% | 83.5% | 92.1% |
For 20/50, the SMA portfolio fell 24.73% from its previous high, while EMA fell 18.64% on the sampled open-price path. Both 5/20 rules lost more from peak to trough than buy-and-hold’s 20.15% drawdown in this sample, despite spending part of the period in cash.
Two settings can change which average finishes ahead
Trading cost can reverse a narrow return lead. Before costs, EMA has a small return lead in this pair. Its extra position changes erode that lead as the assumed cost rises.
SMA vs EMA: the cost of trading
5/20 SPY rules. CAGR on a shared scale from −0.5% to 4%.
0 bp per entry or exit
5 bp per entry or exit
10 bp per entry or exit
25 bp per entry or exit
View the exact chart values.
5/20 pair: changing only the assumed trading cost
| Cost per position change | SMA CAGR | EMA CAGR |
|---|---|---|
| 0 bp | 3.56% | 3.67% |
| 5 bp | 2.80% | 2.87% |
| 10 bp | 2.05% | 2.08% |
| 25 bp | −0.17% | −0.26% |
EMA leads at zero, 5 and 10 bp; SMA leads at 25 bp. The signals have not changed, so neither have the trade counts. What changes is the money left after paying for them. Compare costs that fit your order size and execution rather than treating this article’s 25 bp assumption as a universal rate.
EMA calculation settings can change the ranking. Two platforms can display different EMA values if they use different calculation conventions. Here, changing only how the opening weights are handled reverses a small return lead. The main table uses recursive weights, while the alternative normalizes the weights of the available history.
50/200 pair: changing only the EMA weighting setting
| Calculation | Cost-net CAGR |
|---|---|
| SMA | 9.23% |
| EMA: recursive weights | 9.44% |
| EMA: normalized weights | 9.21% |
With normalized weights, EMA’s small lead over SMA becomes a small shortfall. Neither version is a mistake just because it gives a different result; the platform and the test need to use the same convention.
More history before the evaluation period can reduce the influence of an EMA’s starting value. Match that preparation period as well as the indicator settings when comparing a chart with a backtest.
EMA calculation reference: pandas exponentially weighted calculations.
Common questions about SMA and EMA crossovers
Does EMA always cross before SMA?
EMA gives recent prices more weight, but a crossover depends on both the fast and slow averages. Their relative positions and the price path can change which pair crosses first.
Do fewer trades mean fewer whipsaws?
Fewer trades mean fewer entries and exits to pay for. To measure whipsaws, first define what counts as one, such as a losing round trip closed within a stated number of days. This test reports changes in position without classifying those trades as whipsaws.
Which is easier for a beginner to understand?
SMA is easier to calculate by hand because each close inside the window has equal weight. That makes its calculation easier to explain, but does not make the trading rule more profitable or safer. Start with a rule you can reproduce before deciding whether to use it.
Data and calculation details
Method at a glance: pinned SPY observations, signals from the prior close, next-open positions, and 25 basis points charged at each position change. Each parameter pair begins when its slow average is available. The full assumptions and runnable code below explain start dates, wealth accounting, annualization, risk measures and source limits.
Which should you use?
If you want an average whose calculation is easy to inspect, SMA is a reasonable starting point. If you want recent prices to carry more weight, EMA provides that weighting. For a trading decision, compare the resulting entries, exits, costs and losses before committing money.
An SMA vs EMA crossover comparison is useful only when the test conditions stay the same. A small return lead that disappears under another plausible cost or EMA setting is weak evidence for choosing a rule.
YOUR TURN
When you compare the same rule before and after your trading costs, does its return advantage survive, and what drawdown would you have had to accept?
Disclosure: No broker, fund issuer, or charting platform paid for this analysis. Examples are educational and are not personalized investment advice.
Update history
- VERIFICATION / DATE
Ran the published reconstruction and a separate implementation against the pinned CSV, confirming all twelve main rows, cost sensitivity and normalized-weight EMA result. Reconciled the top review date with the verification history. Figures, chart, code and conclusions are unchanged.
- NAVIGATION / VERIFICATION
Reordered the contents list to match the comparison objective already placed first. Recomputed all twelve SMA/EMA results and the displayed cost and weighting sensitivities; figures, code and analysis are unchanged.
- : Clarified the distinction between a full-stock reference and an exposure-matched benchmark.
- v3.02026-10-01UPDATE
Added trading-cost and EMA-setting sensitivity results, open-sampled drawdowns, a cost comparison chart and executable reconstruction code. Clarified valuation dates and data limits, and streamlined the comparison.
-
v2.0
2026-07-22
CORRECTION
Replaced the unsupported universal turnover-drag projection with a measurement-correct reading of Barber and Odean and a reproducible SMA-versus-EMA comparison.
-
v1.0
2026-05-08
PUBLISH
Original publication.
