Tested by BacktestingMax
Best EMA crossover: 7 EMA pairs backtested on 10 markets
What is the best EMA crossover?
No EMA pair was clearly best in our backtest. An EMA (exponential moving average) is an average of recent prices. An EMA crossover trades when a fast EMA, over fewer candles, crosses a slow EMA, over more candles. The two lengths make an EMA pair: 9/21 means a 9-candle and a 21-candle EMA. We tested 7 EMA pairs that traders often use: 5/13, 8/21, 9/21, 12/26, 20/50, 21/55 and 50/200. Each EMA pair ran 40 tests from 2019 to 2025, after trading costs. That is 10 markets (4 currency pairs, gold and 5 stock indices), each on 4 charts, from 15-minute to daily. Every EMA pair lost money in more than half of its 40 tests. To pick the best EMA pair, we counted the tests that made money in 2019–2022, and kept 2023–2025 to check the pick. The 5/13 EMAs made money in the most tests in 2019–2022: 13 of 40, against 11 or 12 for the others. In 2023–2025, 5 of the other 6 EMA pairs made money in more tests than the 5/13 EMAs. The market and the chart changed the result more than the EMA pair. On 1-hour charts, USD/JPY made money with all 7 EMA pairs, and EUR/USD lost money with all 7.
40 backtests 2019–2025 Trading costs included Tested 16 November 2026
Where it worked 40 backtests- Made money
- 11 of 40 tests, with the 5/13 EMAs (the EMA pair we picked using 2019–2022)
- Made money in both periods
- 5 2019–2022 and again 2023–2025
- Best backtest
- +167% USD/JPY, 1-hour chart: account growth 2019–2025
Made money in both periods
- USD/JPY, 4-hour
- Gold, 4-hour
- Gold, daily
- Nasdaq 100, 1-hour
- DAX, 1-hour
Lost money on every market
- 15-minute charts
The results
Results on every market
Each box shows one backtest of the EMA crossover with the 5/13 EMAs (the EMA pair we picked using 2019–2022), from 2019 to 2025, after trading costs: the % result, and a small chart of the account balance. The solid line is the account balance and the dashed line is the starting balance. Green results made money; red results lost money. Under each result: whether it made money in both 2019–2022 and 2023–2025, or passed all four of our checks (see "How a test passes" further down).
| Market | 15-minute | 1-hour | 4-hour | daily |
|---|---|---|---|---|
| EUR/USD | −100% Lost money. Account down 90% by Aug 2019 | −79% Lost money | +8% Made money overall, lost in one period | −8% Lost money |
| GBP/USD | −99% Lost money. Account down 90% by Nov 2019 | −81% Lost money | −19% Lost money | +6% Made money overall, lost in one period |
| USD/JPY | −99% Lost money. Account down 90% by Jan 2020 | +167% Made money overall, lost in one period | +32% Made money in both periods | +11% Made money overall, lost in one period |
| AUD/USD | −100% Lost money. Account down 90% by Sept 2019 | −76% Lost money | −53% Lost money | −5% Lost money |
| Gold | −98% Lost money. Account down 90% by Feb 2020 | +27% Made money overall, lost in one period | +51% Made money in both periods | +9% Passed all four checks |
| S&P 500 | −97% Lost money. Account down 90% by Sept 2022 | −40% Lost money | −30% Lost money | +17% Too few trades |
| Nasdaq 100 | −82% Lost money | +95% Made money in both periods | −2% Lost money | +8% Made money overall, lost in one period |
| Dow Jones | −95% Lost money. Account down 90% by Mar 2024 | −43% Lost money | −1% Lost money | +3% Too few trades |
| DAX | −97% Lost money. Account down 90% by Aug 2021 | +122% Made money in both periods | −15% Lost money | −3% Lost money |
| FTSE 100 | −99% Lost money. Account down 90% by Dec 2020 | −89% Lost money | −24% Lost money | −6% Lost money |
All the numbers, test by test
| Market | Chart | Trades | Win rate | Profit factor | Result | Max drawdown | 2019–2022 | 2023–2025 | Monte Carlo drawdown | Trading costs |
|---|---|---|---|---|---|---|---|---|---|---|
| EUR/USD | 15-minute | 4,177 | 22.6% | 0.66 | −99.5% | −99.6% | −99.3% | −28.5% | −99.7% | $5,477 |
| EUR/USD | 1-hour | 3,022 | 27.8% | 0.89 | −78.7% | −78.7% | −60.0% | −46.9% | −87.5% | $5,275 |
| EUR/USD | 4-hour | 715 | 30.5% | 1.02 | +7.8% | −30.8% | +28.0% | −15.8% | −36.0% | $1,295 |
| EUR/USD | daily | 134 | 29.1% | 0.82 | −7.9% | −11.7% | −9.9% | +2.3% | −17.7% | $65 |
| GBP/USD | 15-minute | 4,663 | 24% | 0.68 | −99.4% | −99.5% | −99.1% | −33.7% | −99.6% | $5,172 |
| GBP/USD | 1-hour | 3,014 | 27.4% | 0.91 | −80.6% | −86.4% | −41.8% | −66.6% | −88.4% | $7,096 |
| GBP/USD | 4-hour | 756 | 32.5% | 0.94 | −18.9% | −42.6% | +6.0% | −23.5% | −43.7% | $1,202 |
| GBP/USD | daily | 114 | 37.7% | 1.20 | +6.1% | −6.4% | −0.1% | +6.2% | −9.7% | $60 |
| USD/JPY | 15-minute | 8,593 | 24.4% | 0.79 | −99.0% | −99.3% | −98.1% | −49.1% | −99.5% | $9,136 |
| USD/JPY | 1-hour | 2,923 | 27.6% | 1.13 | +167.0% | −42.8% | −4.6% | +179.8% | −56.5% | $8,845 |
| USD/JPY | 4-hour | 699 | 32.2% | 1.11 | +32.2% | −20.4% | +19.8% | +10.4% | −34.1% | $1,049 |
| USD/JPY | daily | 121 | 25.6% | 1.27 | +10.6% | −15.9% | −2.5% | +13.4% | −14.4% | $63 |
| AUD/USD | 15-minute | 2,893 | 22.8% | 0.69 | −99.5% | −99.5% | −99.4% | −23.1% | −99.6% | $7,814 |
| AUD/USD | 1-hour | 2,941 | 27.8% | 0.91 | −76.1% | −78.8% | −27.6% | −67.0% | −86.2% | $8,769 |
| AUD/USD | 4-hour | 773 | 28.1% | 0.80 | −52.5% | −62.8% | −24.6% | −37.0% | −62.1% | $1,224 |
| AUD/USD | daily | 120 | 30.8% | 0.90 | −4.5% | −16.4% | +10.3% | −13.4% | −18.4% | $96 |
| Gold | 15-minute | 4,301 | 23.9% | 0.75 | −98.2% | −98.4% | −97.8% | −21.3% | −98.8% | $10,694 |
| Gold | 1-hour | 2,844 | 26.5% | 1.03 | +27.4% | −54.1% | −1.4% | +29.2% | −65.3% | $8,765 |
| Gold | 4-hour | 730 | 29.9% | 1.17 | +51.0% | −26.6% | +11.3% | +35.7% | −31.5% | $1,256 |
| Gold | daily | 122 | 27% | 1.24 | +8.5% | −5.9% | +0.5% | +8.0% | −13.5% | $60 |
| S&P 500 | 15-minute | 10,932 | 26% | 0.88 | −96.9% | −98.0% | −89.5% | −70.8% | −99.0% | $10,894 |
| S&P 500 | 1-hour | 2,724 | 28% | 0.96 | −39.9% | −50.5% | −4.9% | −36.8% | −74.1% | $5,228 |
| S&P 500 | 4-hour | 715 | 31.3% | 0.89 | −29.5% | −37.1% | −17.7% | −14.4% | −51.7% | $622 |
| S&P 500 | daily | 96 | 44.8% | 1.50 | +16.8% | −4.2% | +7.0% | +9.1% | −9.2% | $34 |
| Nasdaq 100 | 15-minute | 10,845 | 26.5% | 0.94 | −82.0% | −87.5% | −76.3% | −24.1% | −96.6% | $16,450 |
| Nasdaq 100 | 1-hour | 2,694 | 29.6% | 1.06 | +95.2% | −33.9% | +61.7% | +20.7% | −56.3% | $6,762 |
| Nasdaq 100 | 4-hour | 680 | 31.6% | 0.99 | −1.5% | −16.4% | +1.5% | −3.0% | −37.3% | $574 |
| Nasdaq 100 | daily | 101 | 35.6% | 1.24 | +7.5% | −5.0% | +8.3% | −0.8% | −9.5% | $25 |
| Dow Jones | 15-minute | 9,538 | 25.8% | 0.94 | −94.9% | −95.7% | −63.8% | −85.9% | −98.2% | $12,185 |
| Dow Jones | 1-hour | 2,789 | 27.5% | 0.96 | −42.9% | −64.2% | +15.9% | −50.7% | −73.9% | $3,372 |
| Dow Jones | 4-hour | 714 | 30.7% | 0.99 | −1.2% | −29.6% | −23.4% | +28.9% | −37.6% | $354 |
| Dow Jones | daily | 75 | 38.7% | 1.12 | +2.5% | −6.8% | +0.8% | +1.7% | −9.7% | $15 |
| DAX | 15-minute | 6,630 | 25.1% | 0.90 | −97.3% | −98.3% | −94.4% | −51.1% | −98.7% | $7,602 |
| DAX | 1-hour | 2,746 | 29.8% | 1.09 | +122.4% | −31.9% | +14.3% | +94.6% | −54.1% | $4,291 |
| DAX | 4-hour | 795 | 28.9% | 0.94 | −15.1% | −33.4% | −21.0% | +7.4% | −45.4% | $402 |
| DAX | daily | 117 | 31.6% | 0.93 | −2.5% | −8.1% | −6.0% | +3.7% | −14.2% | $19 |
| FTSE 100 | 15-minute | 5,048 | 24.3% | 0.82 | −99.1% | −99.2% | −98.7% | −32.2% | −99.4% | $7,847 |
| FTSE 100 | 1-hour | 2,848 | 26.4% | 0.85 | −89.1% | −91.0% | −61.7% | −71.5% | −92.4% | $4,170 |
| FTSE 100 | 4-hour | 764 | 30% | 0.90 | −23.6% | −39.6% | −31.8% | +12.0% | −46.8% | $915 |
| FTSE 100 | daily | 141 | 29.8% | 0.85 | −6.3% | −13.3% | −3.6% | −2.9% | −18.8% | $65 |
Profit factor is the money won divided by the money lost. Above 1 means the test made money. Max drawdown is the biggest fall from the highest balance. 2019–2022 and 2023–2025 show the result in each period on its own. Monte Carlo drawdown: we shuffled the trades into a random order 1,000 times; in 95% of those runs, the worst drawdown was this number or less. Result is the change in the account, with the risk of each trade set to 1% of the account at that time.
The account balance
The best test and the middle test
What we found
What the 40 backtests show
The EMA pair that made money in the most tests in 2019–2022 did not stay ahead. In 2019–2022, the 5/13 EMAs made money in 13 of 40 tests, the most of the 7 EMA pairs. In 2023–2025, they made money in 16 of 40, and 5 of the other 6 EMA pairs made money in more. We also tried picking an EMA pair for each market and chart on its own: the EMA pair with the highest result on that market and chart in 2019–2022. We did this for 30 combinations: 10 markets on 1-hour, 4-hour and daily charts. In 2023–2025, the picked EMA pair ranked 4.2 out of 7 on average, where 1 is the best result. An EMA pair picked at random would rank 4 on average. So picking by past results did no better than picking at random (see 'Picking an EMA pair from past results' below).
The market and the chart changed the result more than the EMA pair. AUD/USD and the FTSE 100 lost money with all 7 EMA pairs on all 4 charts: 28 tests each. On 1-hour charts, USD/JPY made money with all 7 EMA pairs, gold and the Nasdaq 100 with 6 of them, and EUR/USD with none. On 15-minute charts, every EMA pair lost money on at least 8 of the 10 markets. A slower EMA pair made fewer trades there, but each trade cost just as much. With every EMA pair, trading costs took 5% to 6% of the money a trade risked. On daily charts, every EMA pair except 12/26 made money on 6 or 7 markets out of 10. But most daily tests made fewer than 100 trades in 7 years, which is too few to judge.
One EMA pair on one chart made money in both periods on more markets than any other: the 50/200 EMAs on 1-hour charts. They made money in both 2019–2022 and 2023–2025 on 5 of the 10 markets: USD/JPY, the S&P 500, the Nasdaq 100, the Dow Jones and the DAX. No other EMA pair did this on more than 4 markets on any chart. But we found it by looking at all 28 combinations (7 EMA pairs × 4 charts) after the test, so it could be luck. The result also depended on a few big trades. On 1-hour charts, the 50/200 EMAs made 2,515 trades on the 10 markets, and only 16.7% of them made money. We measure each trade in R: 1R is the money the trade risked, 1% of the account. Together, the 2,515 trades made 234.4R. Without their best 10 trades, they would have lost 101.2R. 4 of those 10 trades were short trades on stock indices during the crash of February and March 2020.
Picking an EMA pair from past results
The EMA pair picked on 2019–2022 came anywhere from 1st to 7th in 2023–2025
We looked at 30 combinations of market and chart: 10 markets on 1-hour, 4-hour and daily charts. For each one, we picked the EMA pair with the highest result in 2019–2022. Then we ranked the 7 EMA pairs by their result in 2023–2025 and noted where the picked EMA pair came. Each bar counts the combinations.
- 1st: the best again 5 of 30
- 2nd 2 of 30
- 3rd 4 of 30
- 4th 6 of 30
- 5th 4 of 30
- 6th 2 of 30
- 7th: the worst 7 of 30
If the picked EMA pair had stayed the best, most combinations would be in the first bar. An EMA pair picked at random would come in each place in about 4 of the 30. We left out the 15-minute charts: many accounts there had lost 90% of their money before 2023. An account that small skips most trades (see 'Smallest trade size' under 'What the EMA crossover is').
Every EMA pair on every chart
In our tests, the chart changed the result more than the EMA pair
Each cell counts the markets, out of 10, where that EMA pair made money on that chart from 2019 to 2025, after trading costs. The last column shows how often each EMA pair traded: the average number of trades a year on one market, on 1-hour charts.
| EMA pair | 15-minute | 1-hour | 4-hour | Daily | Average trades a year on one market, 1-hour chart |
|---|---|---|---|---|---|
| 5/13 | 0 of 10 | 4 of 10 | 3 of 10 | 6 of 10 | 408 |
| 8/21 | 0 of 10 | 4 of 10 | 2 of 10 | 7 of 10 | 261 |
| 9/21 | 0 of 10 | 4 of 10 | 4 of 10 | 7 of 10 | 249 |
| 12/26 | 1 of 10 | 5 of 10 | 4 of 10 | 4 of 10 | 196 |
| 20/50 | 2 of 10 | 3 of 10 | 5 of 10 | 6 of 10 | 112 |
| 21/55 | 2 of 10 | 2 of 10 | 5 of 10 | 7 of 10 | 105 |
| 50/200 | 2 of 10 | 5 of 10 | 4 of 10 | 6 of 10 | 36 |
These counts include tests with few trades. On daily charts, only the 5/13 EMAs made 100 trades or more on most markets in 7 years. The other 6 EMA pairs made 3 to 87 trades per daily test, so one or two big trades could decide a daily result.
Market or EMA pair?
On 1-hour charts, the market changed the result more than the EMA pair
Each card shows a middle result (the median) of the 1-hour tests from 2019 to 2025: the % change of the account, after trading costs. For a market, it is the middle of its 7 results, one with each EMA pair. For an EMA pair, it is the middle of its 10 results, one on each market.
- Market with the highest middle result: USD/JPY
- +167% made money with all 7 EMA pairs
- Markets with the lowest: AUD/USD and the FTSE 100
- −73% both −73%, and both lost money with all 7 EMA pairs
- EMA pair with the highest middle result: 50/200
- +0.7% made money on 5 of the 10 markets
- EMA pair with the lowest: 5/13
- −41% made money on 4 of the 10 markets
The middle results of the 10 markets were spread from −73% to +167%. The middle results of the 7 EMA pairs were spread only from −41% to +0.7%.
The strategy
What the EMA crossover is
An EMA (exponential moving average) is an indicator that shows the average closing price of recent candles, where the newest candles count the most. The EMA crossover strategy uses two EMAs: a fast EMA over fewer candles and a slow EMA over more candles. Traders write the EMA pair as fast/slow: 9/21 means a 9-candle EMA and a 21-candle EMA. After price has been rising for a while, the fast EMA crosses above the slow EMA, and the strategy buys. After price has been falling for a while, the fast EMA crosses below the slow EMA, and the strategy sells short. An EMA pair with small numbers, like 5/13, is a fast EMA pair: it follows price closely and crosses often. An EMA pair with large numbers, like 50/200, is a slow EMA pair: it crosses rarely, usually only after a long move. Traders disagree about which EMA pair is best, so we tested 7 EMA pairs that they often use. Both lengths count candles, not hours. So the same EMA pair looks back 4 times as far on a 4-hour chart as on a 1-hour chart.
- EMA pairs
- 5/13, 8/21, 9/21, 12/26, 20/50, 21/55 and 50/200, on closing prices. The results grid shows the 5/13 EMAs, the EMA pair that made money in the most tests in 2019–2022. The table under 'Can the EMA crossover be improved?' compares all 7. A test places no trade until the slow EMA has as many candles as its length: 200 candles for the 50/200 EMAs, about 9 months of a daily chart.
- Stop-loss
- 2 × ATR(14), set when the trade opens. The ATR (average true range) measures how far price moves in an average candle. Here it is Wilder's average over 14 candles. The stop-loss does not move, and every EMA pair uses the same stop-loss rule.
- Take-profit
- None. A cross the other way closes the trade.
- Risk per trade
- 1% of the account at that time. The account started at $10,000. The trade size is rounded down to a size the market allows. The value of a trade can be at most 30 times the account on currency pairs, and 20 times on gold and the indices (this limit is called leverage). When the stop-loss is very close, a 1% risk needs a bigger trade than that. Then the trade is cut to the limit and risks less than 1%. This happened to 185 out of 289,847 trades on 15-minute charts, 174 of them on USD/JPY and EUR/USD. 10 more signals (crosses that should open a trade) were not traded at all. The price moved before the trade could open, and even the cut trade was over the limit.
- Trading costs
- The only trading cost we charged is the spread: the gap between the buy price and the sell price. The spread is 0.8 pips on EUR/USD, 1.2 on GBP/USD, 0.9 on USD/JPY and 1.0 on AUD/USD (a pip is 0.0001, or 0.01 on USD/JPY). On gold, it is $0.30 an ounce. On the stock indices, it is 0.4 points on the S&P 500, 1.5 on the Nasdaq 100 and 2.0 on the Dow Jones. On the DAX and the FTSE 100, it is 1.0 point. For the Nasdaq 100, the Dow Jones, the DAX and the FTSE 100, these are wider than our backtest engine's default spreads, to match a typical retail broker. The rules use only market orders and stop-losses, so every trade pays half the spread when it opens and half when it closes. There is no commission. The cost of a trade depended on the chart, not on the EMA pair. On average, it was about 5.4% of the money the trade risked on 15-minute charts: $5.40 for every $100 risked. It was 2.5% on 1-hour charts, 1.2% on 4-hour charts and 0.4% on daily charts.
- Smallest trade size
- Each market has a smallest trade: 1,000 units of a currency pair, 1 ounce of gold, or 0.1 of an index contract. When the trade that risks 1% would be smaller than that, the test skips the signal. While an account still had at least half of its starting balance, 309 out of about 195,000 signals were skipped, all on gold and the stock indices. 206 of them were on daily charts, where the stop-loss is far from the price. The Dow Jones daily chart skipped the most. There, the 5/13 EMAs skipped 44 signals and made 75 trades, and the 50/200 EMAs skipped 9 and made 3. Accounts that had already lost more than half of their money skipped many more signals: 108,371, almost all on 15-minute charts. That was about 1 in 3 of their signals, so those tests traded much less after the account had shrunk.
- Overnight (swap) fees
- Not included. Brokers charge (or sometimes pay) a fee for each night a trade stays open. Half of the trades closed within 2 to 7 hours on 15-minute charts, depending on the EMA pair. On 1-hour charts, half closed within 9 to 26 hours, on 4-hour charts within 2 to 5.5 days, and on daily charts within 12 to 28 days. Slower EMA pairs kept their trades open longer. So these fees would change the results most on 4-hour and daily charts, and they could make a result better or worse.
- Price data
- We used CFD prices. A CFD (contract for difference) is a contract with a broker that pays the change in a market's price. Most brokers outside the US offer CFDs for trading these markets. The test leaves out two kinds of candle, so that they don't change the EMAs or the ATR. The first kind is a tiny extra candle after the weekly close at 17:00 New York time. Some Fridays in our S&P 500, DAX and FTSE 100 data have a few minutes of prices then. The second kind is a candle with no price change at all (the high equals the low), for example on a market holiday. These were less than 1% of the candles in every test, except the DAX daily chart (1.8%) and every FTSE 100 chart (1.4% to 3.6%).
- DAX and FTSE 100 data
- Our DAX and FTSE 100 data has some wrong prices, but removing them would not change this page's answer. They appear in minutes with no trading, late in the evening. On the DAX, most are from 22:00 to 23:00 German time, and on the FTSE 100, from 21:00 to 22:00 UK time. They are usually about 1.2% away from the last real price, and at most 3.7%. From 2019 to 2025, they appear on 44 days on the DAX and on 9 days on the FTSE 100, out of about 1,800 trading days. We kept them in the results, because BacktestingMax runs on the same price data. To see what they change, we ran the DAX and FTSE 100 tests again without them. On 15-minute charts, 6 of the 7 DAX tests did better without them. With the 20/50 EMAs, the 15-minute DAX test made +467.2% without them and +222.3% with them. With the 21/55 EMAs, it made +192.5% without them and +14.9% with them. Every 1-hour DAX test did as well or better without them: with the 5/13 EMAs, +144.3% against +122.4%. The 4-hour and daily DAX tests changed less: the biggest change was from +0.8% to +9.4%, with the 12/26 EMAs on 4-hour charts. The FTSE 100 tests changed even less: the biggest change was from −23.6% to −27.4%, with the 5/13 EMAs on 4-hour charts. All 28 FTSE 100 tests still lost money. Without the wrong prices, 3 more DAX tests would have made money in both periods. These were the 20/50 EMAs on 15-minute charts, the 9/21 EMAs on 1-hour charts and the 12/26 EMAs on 4-hour charts. In 2019–2022, the 20/50 EMAs would then tie the 5/13 EMAs for the most tests that made money: 13 of 40. In 2023–2025, 3 other EMA pairs would tie the 50/200 EMAs for the most: 18 of 40. The 5/13 EMAs would still make money in fewer 2023–2025 tests than 5 of the other 6 EMA pairs.
The rules we tested
- Choose an EMA pair, for example 20/50: a 20-candle fast EMA and a 50-candle slow EMA. All 7 EMA pairs use the same rules.
- Buy when the fast EMA crosses above the slow EMA. We check for a cross when each candle closes, and the trade opens at the next candle's open.
- Sell short when the fast EMA crosses below the slow EMA. A short trade makes money if price falls.
- When the EMAs cross the other way, close the trade at the next candle's open, and open a new trade in the new direction. In our test, the new trade opens one candle after the old trade closes, because the rules wait until the old trade is closed. After a stop-loss, stay out of the market until the next cross.
- ATR is an indicator of how far price moves in an average candle, measured over the last 14 candles. Put the stop-loss 2 times the ATR away from the entry price. The stop-loss does not move.
- Size every trade so that, if the stop-loss is hit, the trade loses 1% of the account at that time.
The method
How we tested it
The test
- Markets
- EUR/USD, GBP/USD, USD/JPY, AUD/USD, Gold, S&P 500, Nasdaq 100, Dow Jones, DAX and FTSE 100
- Charts
- 15-minute, 1-hour, 4-hour and daily candles
- Dates
- January 2019 to December 2025
- Account
- $10,000, risking 1% of the account on each trade
- Trading costs
- Included. Every trade pays that market's normal trading cost: the spread, which is the gap between the buy price and the sell price.
How a test passes
We call a test passed only if it meets all four checks. A strategy can make money in one backtest and still fail one of these checks.
- At least 100 trades. With fewer trades, a good result could be luck.
- It made money from 2019 to 2022 and again from 2023 to 2025. This shows whether the strategy kept working in the newer years, not only in the older ones.
- A profit factor (the money won divided by the money lost) of at least 1.2 from 2023 to 2025, after trading costs.
- In 95% of 1,000 random shuffles of the trades, the account must not fall more than 30% from its highest point.
Improvements
Can the EMA crossover be improved?
Here, improving the EMA crossover means choosing a better EMA pair. Each row is one EMA pair, run with the same rules on the same 40 tests: 10 markets on 4 charts. An EMA pair picked as the best of 7 on some years will look good on those years, because it was picked for that. So we picked the best EMA pair using 2019–2022 only: the one that made money in the most tests. Then we checked it on 2023–2025, the years we did not use to pick it. The first two columns count every test. The last two columns leave out tests with fewer than 100 trades. The slow EMA pairs made fewer than 100 trades in many tests, most of all on daily charts.
| Version | Made money 2019–2022years used to pick the best version | Made money 2023–2025years not used to pick it | Made money in both periods | Passed all four checks |
|---|---|---|---|---|
| 5/13 EMAsBest on 2019–2022 A 5-candle and a 13-candle EMA. 5 and 13 are Fibonacci numbers (each number is the sum of the two before it: 1, 2, 3, 5, 8, 13, 21, 34, 55), which some traders prefer. It is the fastest EMA pair we tested, and it made the most trades. | 13 of 40middle test −8.0% | 16 of 40middle test −13.9% | 5 | 1 |
| 8/21 EMAs An 8-candle and a 21-candle EMA. 8 and 21 are also Fibonacci numbers. Traders often use this EMA pair for day trading, like 9/21. | 11 of 40middle test −9.4% | 17 of 40middle test −1.6% | 4 | 0 |
| 9/21 EMAs A 9-candle and a 21-candle EMA, one of the most popular EMA pairs for day trading. It also has its own backtest page, linked under 'Related strategies we tested', with tests from 2014 and on 5-minute charts too. | 11 of 40middle test −8.2% | 17 of 40middle test −3.4% | 2 | 0 |
| 12/26 EMAs A 12-candle and a 26-candle EMA: the two EMAs inside the MACD indicator. MACD is the 12-candle EMA minus the 26-candle EMA, so these two EMAs cross when MACD crosses zero. | 12 of 40middle test −10.7% | 17 of 40middle test −4.2% | 5 | 1 |
| 20/50 EMAs A 20-candle and a 50-candle EMA. Traders often use this EMA pair for swing trading: holding trades for days or weeks. | 12 of 40middle test −8.5% | 15 of 40middle test −5.8% | 3 | 1 |
| 21/55 EMAs A 21-candle and a 55-candle EMA. 21 and 55 are also Fibonacci numbers. | 12 of 40middle test −8.4% | 17 of 40middle test −3.6% | 4 | 1 |
| 50/200 EMAs A 50-candle and a 200-candle EMA. Their crosses are the EMA form of the golden cross (the 50 crosses above the 200) and the death cross (the 50 crosses below the 200). Traders usually watch these on daily charts. It is the slowest EMA pair we tested, and it made the fewest trades. | 11 of 40middle test −3.9% | 18 of 40middle test −1.6% | 6 | 0 |
Choosing the EMA pair from past results did not improve the EMA crossover: the EMA pair picked on 2019–2022 did not stay the best in 2023–2025. The 5/13 EMAs made money in the most tests in 2019–2022, the years we used to pick: 13 of 40. The other 6 EMA pairs made money in 11 or 12. In 2023–2025, the years we did not use to pick, 5 of the other 6 EMA pairs made money in more tests than the 5/13 EMAs. In 2023–2025, the middle test of the 5/13 EMAs (the median of their 40 results) was also the lowest of the 7: −13.9%. The 50/200 EMAs changed the other way: from 11 of 40 in 2019–2022 to 18 of 40 in 2023–2025, the highest of the 7. Only 4 of the 280 tests (7 EMA pairs × 40) passed all four checks, each with a different EMA pair. They were: 5/13 on gold, daily; 12/26 on gold, 4-hour; 20/50 on the Nasdaq 100, 4-hour; and 21/55 on the S&P 500, 4-hour.
Passed all four checks with 5/13 EMAs
- Gold, daily
Questions
Questions traders ask
What is the best EMA crossover?
No EMA pair was clearly best in our backtest. An EMA pair is the two lengths of an EMA crossover, like 9/21: a 9-candle and a 21-candle EMA. We tested 7 EMA pairs, from 5/13 to 50/200, on 10 markets and 4 charts, from 2019 to 2025, after trading costs. The 5/13 EMAs made money in the most tests in 2019–2022, but in 2023–2025, 5 of the other 6 EMA pairs made money in more tests. The market and the chart changed the result more than the EMA pair. On 1-hour charts, USD/JPY made money with all 7 EMA pairs, and EUR/USD, AUD/USD and the FTSE 100 lost money with all 7.
What is the best EMA for day trading?
We took day trading to mean 15-minute and 1-hour charts. On 15-minute charts, each of the 7 EMA pairs lost money on at least 8 of the 10 markets, from 2019 to 2025, after trading costs. A slower EMA pair, like 50/200, made fewer trades there, but each trade paid about the same trading cost: 5% to 6% of the money the trade risked. On 1-hour charts, the market changed the result more than the EMA pair. USD/JPY made money with all 7 EMA pairs, gold and the Nasdaq 100 with 6 of them, and EUR/USD, AUD/USD and the FTSE 100 with none. We did not test 5-minute charts.
What are the best EMA settings for a crossover?
There was no best EMA pair in our test. The 7 EMA pairs made money in about the same number of tests, and their order changed between 2019–2022 and 2023–2025. Both EMA lengths count candles, not hours, so the same EMA pair means something different on each chart. 5/13 on a 4-hour chart looks back about as far as 20/50 on a 1-hour chart. In both cases, the fast EMA covers about 20 hours and the slow EMA about 50 hours. The two had about the same number of trades, about 730 to 790 per test. They also made money in both 2019–2022 and 2023–2025 on the same 2 markets: USD/JPY and gold. So the chart is part of the setting.
Which EMA crossover has the highest win rate?
The 5/13 EMAs, the fastest EMA pair we tested, had the highest win rate on every chart: 25% to 32% of their trades made money. The 50/200 EMAs, the slowest, had the lowest: 16% to 17%. The stop-loss closed 75% to 78% of the 50/200 trades, and only 12% to 20% of the 5/13 trades. A slow EMA pair takes longer to cross back, so price has more time to reach the stop-loss first. A higher win rate did not mean better results. On 1-hour charts, the 50/200 EMAs made money in both 2019–2022 and 2023–2025 on 5 of the 10 markets, and the 5/13 EMAs on only 2.
Keep exploring
Related strategies we tested
Moving averages 9/21 EMA crossover backtest: from 5-minute to daily charts Made money in 10 of 40 tests, 5 of them in both periods. Best: USD/JPY, 1-hour, +539% Moving averages Golden cross and death cross strategy backtest Made money in 4 of 20 tests, 3 of them in both periods. Best: Gold, 4-hour, +47% RSI RSI + 50 EMA strategy backtest Made money in 4 of 24 tests, 2 of them in both periods. Best: Nasdaq 100, 1-hour, +40% MACD MACD + 200 EMA strategy backtest Made money in 8 of 40 tests, 5 of them in both periods. Best: Gold, 1-hour, +30% VWAP VWAP + 9 EMA strategy backtest on NQ and ES futures Made money in 5 of 6 tests, 0 of them in both periods. Best: MNQ (Micro Nasdaq 100), 15-minute, +91% MACD MACD crossover strategy backtest Made money in 6 of 21 tests, 4 of them in both periods. Best: DAX, 1-hour, +294%The strategy code we ran
This is the exact code from the BacktestingMax strategy engine. Paste it into the strategy editor in the app to run it on any market.
class BestEmaCrossover(Strategy):
"""The EMA crossover with any pair of EMAs, to compare the pairs traders use: 5/13, 8/21,
9/21, 12/26, 20/50, 21/55 and 50/200 (set fast and slow). Every pair trades the same rules.
The defaults, 5/13, are the pair the page's results grid shows.
Rules: buy when the fast EMA crosses above the slow EMA, sell short when it crosses below.
The opposite cross closes the trade and opens a new one the other way (the exit fills at
the next candle's open, the new trade one candle later). A stop-loss 2 x ATR(14) away caps
each trade; size so that the stop costs 1% of the account. After a stop-loss, wait for the
next cross. If 1% of the account is less than the smallest trade size the market allows,
the engine skips the trade.
Skipped candles: a candle that opens on a Friday at 17:00 New York time or later, and a
candle where price did not move at all (high = low). The markets in this test are closed
then, but some index data has a few minutes of prices after the Friday close, which make a
tiny extra candle, and market holidays show up as flat candles. The strategy ignores both:
they don't go into the EMAs or the ATR, and no cross, exit or trade is worked out on them.
That is why the EMAs and the ATR are worked out here instead of with the built-in
indicators. The formulas are the built-in ones: EMA with weight 2 / (n + 1), started at the
first close and used from the n-th candle; ATR as Wilder's average of the true range.
On a market that trades at the weekend (crypto), remove the Friday skip.
"""
params = {"fast": Param(type=int, default=5, min=2, max=400),
"slow": Param(type=int, default=13, min=3, max=500),
"atr_period": Param(type=int, default=14, min=2, max=100),
"atr_mult": Param(type=float, default=2.0, min=0.5, max=10.0)}
lookback = 2
def init(self, ctx):
self.ny = ctx.clock("America/New_York")
self.fast_ema = None # the EMAs, over the candles the strategy uses
self.slow_ema = None
self.used = 0 # how many candles the strategy has used
self.prev_fast = None # the EMAs on the previous candle used
self.prev_slow = None
self.prev_close = None
self.atr = None # Wilder's average of the true range, as the built-in ATR
self.reverse_to = None # "long" / "short": open this once the closing trade is gone
def on_bar(self, ctx):
high, low, close = ctx.high[0], ctx.low[0], ctx.close[0]
# A tiny candle after the Friday close, or a flat holiday candle (see above): ignore it.
if (self.ny.weekday == 4 and self.ny.hour >= 17) or high == low:
return
p = ctx.params
if self.prev_close is None:
true_range = high - low
else:
true_range = max(high - low, abs(high - self.prev_close), abs(low - self.prev_close))
self.prev_close = close
self.atr = true_range if self.atr is None else self.atr + (true_range - self.atr) / p.atr_period
if self.fast_ema is None:
self.fast_ema = self.slow_ema = close
else:
self.fast_ema += 2.0 / (p.fast + 1) * (close - self.fast_ema)
self.slow_ema += 2.0 / (p.slow + 1) * (close - self.slow_ema)
self.used += 1
ready = self.used >= p.slow and self.used >= p.atr_period
f0, s0 = (self.fast_ema, self.slow_ema) if ready else (None, None)
f1, s1 = self.prev_fast, self.prev_slow
self.prev_fast, self.prev_slow = f0, s0
if f0 is None or f1 is None:
return
cross_up = f1 <= s1 and f0 > s0 # the fast EMA crosses above the slow EMA
cross_down = f1 >= s1 and f0 < s0 # the fast EMA crosses below the slow EMA
pos = ctx.position
if pos is not None:
if pos.is_long and cross_down:
ctx.close_position()
self.reverse_to = "short"
elif pos.is_short and cross_up:
ctx.close_position()
self.reverse_to = "long"
return
# A reversal waits one candle for the close to fill. Drop it if the EMAs crossed back.
pending, self.reverse_to = self.reverse_to, None
go_long = cross_up or (pending == "long" and f0 > s0)
go_short = cross_down or (pending == "short" and f0 < s0)
if not ctx.gate("ema_cross", go_long or go_short):
return
entry = close
dist = p.atr_mult * self.atr
if go_long:
stop = entry - dist
ctx.buy(size=ctx.size_by_risk_pct(0.01, stop=stop, entry=entry), sl=stop, tag="ema_long")
else:
stop = entry + dist
ctx.sell(size=ctx.size_by_risk_pct(0.01, stop=stop, entry=entry), sl=stop, tag="ema_short")
Your turn
Test the EMA crossover yourself
Change the settings, the market or the stop-loss and see the result in seconds. Ask the BacktestingMax AI: Backtest an EMA crossover with the 50/200 EMAs and with the 9/21 EMAs on the Nasdaq 100, 1-hour chart, from 2019 to 2025, with a stop-loss at 2 times ATR(14), and compare the results
.
Free account. No credit card needed.
See every strategy we tested Browse strategies shared by tradersBacktest on historical data with trading costs, run by BacktestingMax. Past results do not guarantee future results, and nothing here is financial advice. Updated 16 November 2026.