VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Indicators and signals

EMA crossover strategy: 9/21 vs 50/200 and what holds up on futures

An EMA crossover strategy holds up on futures more often with a slow pair on daily bars than with a fast pair on intraday bars. The pair matters less than two checks: neighbouring settings must behave alike, and the result must stay positive after commission and slippage on data the search never saw.

By · Published · updated · Editorial policy

Contents
  1. Which EMA crossover settings hold up in a futures backtest?
  2. How does a fast and slow EMA crossover rule work?
  3. Is 9/21 or 50/200 the better EMA pair?
  4. Is an EMA crossover better than an SMA crossover?
  5. Does an EMA crossover get whipsawed, and what do costs do to it?
  6. What does an NQ daily-bar backtest of a trend rule show?
  7. Do the best EMA settings differ by market?
  8. Frequently asked questions
  9. References

Which EMA crossover settings hold up in a futures backtest?

An EMA crossover strategy holds up on futures more often with a slow pair on daily bars, such as 50/200, than with a fast pair on intraday bars, such as 9/21. The pair itself matters less than two checks: neighbouring settings must behave alike, and the result must stay positive after commission and slippage on out-of-sample data.

"Holds up" has a plain meaning here. A setting holds up when its average trade after costs is still positive on data that did not help choose it, and when the settings next to it (8/20, 10/22) give a similar result. A pair that only works at one exact value, or only before costs, has described the noise of one history. That is the claim this article defends: the choice between 9/21 and 50/200 is the smaller decision; the plateau test and the cost test decide whether either one is worth trading. The same two tests apply to every rule in the guide to technical analysis tools and indicators you can test; the crossover is simply the one where the cost test bites hardest.

Research on moving-average rules points the same way. Brock, Lakonishok and LeBaron (1992) found that moving-average rules showed predictive patterns on about ninety years of Dow index data before transaction costs. Sullivan, Timmermann and White (1999) retested the same family of rules while correcting for the number of rules tried and found that on the ten years that followed, the best rule no longer outperformed. Park and Irwin (2007) surveyed the later studies and list the same two weak points: costs left out and too many variants compared on one history.

How does a fast and slow EMA crossover rule work?

The rule is long when the fast EMA is above the slow EMA and short or flat when it is below, with the signal read at the bar close and the fill taken on the next bar. An exponential moving average (EMA) is an average of recent closes that gives more weight to the newest close and less to older ones; the moving averages indicator page covers the calculation. A crossover rule is a rule that changes position when a short-length average crosses a long-length average.

The order of events inside one signal matters, because it decides which price the backtest is allowed to use:

  1. At the close of a bar, both EMAs are updated with that close.
  2. If the fast EMA has moved from below to above the slow EMA, the rule records a buy signal. The reverse cross records a sell signal.
  3. On the open of the next bar, the order is filled. The close that produced the signal is not a price you could have traded at, because the signal did not exist until that bar ended.
  4. The position stays open until the opposite cross. A long-and-short rule reverses; a long-only rule goes flat.

Lag is the number of bars between the price turning and the cross confirming the turn. It is built into the rule: the averages must be pulled through each other, and that takes several bars after the actual high or low. A crossover is therefore a late entry by design, unlike bullish and bearish candlestick patterns in a backtest, which fire on one or two bars. The crossover pays for its lateness with fewer, longer trades; whether that trade is a good one is what the rest of the article tests.

A two-EMA crossover on candles: price turns at one bar, the 9 EMA crosses above the 21 EMA three bars later, the signal is read at that bar's close and the order fills at the next bar's open. The down cross works the same way. Fill on the next bar The down cross works the same way EMA 9 EMA 21 Lag: 3 bars Close: signal Next open: fill The signal exists only at the close. So: fill on the next bar's open.
Where the signal is read and where the fill happens in a two-EMA crossover. The lag between the price turn and the cross is part of the rule, not a flaw in the test.

Is 9/21 or 50/200 the better EMA pair?

Neither pair is better in general; each fails in a different way, and only a parameter plateau tells you which one is not a lucky spike on your market. 9/21 trades many times with a small move per trade, so it is the first to fail when costs are added. 50/200 trades a few times a year with large moves and large givebacks, so a handful of trades decide the whole result and the sample stays small. 20/50 sits between them.

Pair (daily bars)Crosses per yearLag at trend startGiveback at trend endSensitivity to costs
9/21ManyShortSmallHigh
20/50MediumMediumMediumMedium
50/200FewLongLargeLow
Three EMA pairs on daily bars compared: 9/21 crosses many times with short lag and small giveback but is highly sensitive to costs; 20/50 is medium on all four; 50/200 crosses few times with long lag, large giveback and low cost sensitivity. Each pair fails its own way Daily bars; boxed = weak point Pair Crosses Lag Giveback Cost hit 9/21 Many Short Small High 20/50 Medium Medium Medium Medium 50/200 Few Long Large Low Fast fails on costs, slow on sample. So: test the plateau, not the pair.
The three popular pairs fail in different ways. A fast pair dies by a thousand small costs; a slow pair lives or dies on a few big trades.

A parameter plateau is a region of neighbouring settings that all give a similar net result. Think of a hill: a plateau is a broad flat top where a step in any direction changes little; a spike is a needle where one step off the top drops you to the valley. When you test fast lengths 8 to 12 against slow lengths 18 to 24 and only 9/21 is good, the 9/21 result is the needle. The market did not reward "9 and 21"; it rewarded one accident of that history. The method for reading such a grid is covered in parameter stability: plateau or lucky spike.

Two grids of fast lengths 8 to 12 against slow lengths 18 to 24, net after costs: in the plateau grid almost every pair around 9/21 is positive; in the spike grid only 9/21 is positive and its neighbours are not. Plateau or lucky spike? Gold box = 9/21; net after costs Plateau Spike Net > 0 Net ≤ 0 Only a plateau says something. So: trade the centre of a plateau.
A plateau versus a spike. Only the left grid says anything about the market; the right grid says something about one stretch of data.

The same grid test is why fast pairs on intraday bars rarely pass. On 5-minute bars the move captured per cross is a few ticks, so the plateau that exists before costs often disappears after them, which is the pattern described in what testing shows about the best indicator for intraday trading. A slow pair on daily bars keeps its plateau more often because each trade captures a move many times the round-trip cost. Its problem is the opposite one: few trades, so the out-of-sample sample must be measured in years.

Is an EMA crossover better than an SMA crossover?

An EMA crossover is earlier, not better: it enters trends sooner and also produces more false crosses than an SMA crossover of the same lengths. A simple moving average (SMA) is the plain average of the last N closes, every close counting the same. The EMA counts the newest close most and each older close a little less, so it bends toward a price turn before the SMA does.

An everyday comparison: an SMA grades a student by averaging all tests equally; an EMA gives the latest test the most weight. The EMA notices a change in form sooner, and it also overreacts to one bad day. The one formula worth knowing is how the weight is set:

EMA today = α × close today + (1 − α) × EMA yesterday, with α = 2 ÷ (N + 1)

Here N is the chosen length, α (alpha) is the share of today's close in the new average, and 1 − α is the share carried over from yesterday's EMA. For N = 21, α is about 0.09, so today's close gets about 9 percent of the weight and the rest decays over the older bars.

PropertyEMA crossoverSMA crossover
Weight on the newest closeLargest, decaying backwardsEqual for every close
Cross at a trend startA few bars earlierA few bars later
False crosses in a sideways stretchMoreFewer
Giveback at a trend endSmallerLarger
Best lengthsMust be found by its own gridMust be found by its own grid
Left: a 21-period SMA gives every close the same weight, a 21-period EMA gives the newest close the most weight, decaying backwards. Right: at the same price turn the 21 EMA turns a few bars before the 21 SMA. EMA turns earlier, not better Both 21 periods; grey line is price Weight per close SMA EMA Newest → EMA SMA Earlier Earlier entries, more false crosses. So: compare both on the same grid.
The EMA weights recent closes more, so it turns earlier than an SMA of the same length. The earlier signal and the extra false crosses come from the same weighting.

So the choice is a trade of lag against whipsaw. Variants that cut lag further, such as the DEMA, the double exponential moving average, push the same trade further in the same direction: earlier crosses, more of them. None of them removes the cost of a false cross; they only change how many you pay for. The honest comparison is to run both crossovers through the same grid, with the same costs, and compare their plateaus, not their best single cells.

Does an EMA crossover get whipsawed, and what do costs do to it?

Yes: in a sideways market the two lines cross repeatedly, and each cross is a paid round trip, so the backtest must include commission and slippage from the first run and the pair must be graded out-of-sample with a rule written before you look. Whipsaw is a sequence of crosses in which each new position is closed at a small loss by the next cross before any trend develops. A thermostat set to one exact temperature behaves the same way: when the room hovers at the threshold, the heating switches on and off every few minutes, and every switch costs something.

The same 9/21 EMA rule on two stretches: in a sideways stretch the lines cross six times and each cross is a paid round trip; in a trending stretch they cross once and the position keeps the move. Six crosses, six costs Same 9/21 rule, two stretches Sideways Trending 6 round trips 1 round trip Sideways crosses cost; trends pay. So: add costs from the first run.
Where a crossover's losses and gains come from. The sideways stretch pays six round trips for nothing; the trending stretch pays one and keeps the move.

Costs decide the fast pair because they are the same size on every trade while the gross move per trade is not. A fixed cost takes a large share of a small move and a small share of a large one.

Hypothetical example

Suppose a round trip costs $30 in commission and slippage on a micro index contract. A fast pair makes 80 crosses a year with a gross average trade of $40; after costs its average trade is $10, and a small rise in slippage makes it negative. A slow pair makes 3 crosses a year with a gross average trade of $900; after the same $30 its average trade is $870, almost unchanged. The slow pair's weakness is elsewhere: 3 trades a year means ten years give 30 trades, too few to judge the average on their own.

Hypothetical example on one scale: a fixed 30 dollar round-trip cost cuts a fast pair's 40 dollar average trade to 10 dollars net, and a slow pair's 900 dollar average trade only to 870 dollars net. The cost bar is the same width in both. Same cost, different damage Hypothetical average trade, one scale Fast pair $40 gross → $10 net Slow pair $900 gross → $870 net Net Cost $30 each Costs eat the fast pair's edge. So: rank pairs after costs.
The same round-trip cost shrinks the fast pair's average trade to almost nothing and barely touches the slow pair's. The cost bar is the same height in both.

Two settings put costs where they belong. First, charge commission and at least one tick of slippage per side inside every evaluation, not after the search, so the ranking never favours the smoothest high-count pair; commission, slippage and the average trade in backtests explains how to set the numbers. Second, write the out-of-sample rule down before the run:

  1. Split the history by date and choose the pair on the earlier part only.
  2. Decide the pass line in advance, for example: the out-of-sample average trade after costs stays positive and at least a third of the in-sample figure, and at least four of the six neighbouring pairs also stay positive.
  3. Run the chosen pair unchanged on the later part and read it against that line.
  4. Accept or reject. Changing the lengths after a soft result turns the later part into in-sample data.

Bailey, Borwein, López de Prado and Zhu (2014) show why the pre-written line is needed: the more pairs you compare on one history, the more the best of them is inflated, and the inflation does not carry into new data. When the thresholds are set in AlphaPrime (Valynox) strategy validation before the search starts, the pass line for the walk-forward and out-of-sample steps is fixed by you in advance, and a crossover pair that fails an early check is dropped before it reaches the later data.

What does an NQ daily-bar backtest of a trend rule show?

The run below shows what a long-horizon trend rule looks like on NQ daily bars after costs: few trades, long holding times, a large drawdown relative to the yearly gain, and a result that depends on a handful of big trends. It did not test an EMA crossover itself. It used a Momentum rule, a stand-in trend rule built from the standard Momentum indicator, as its only entry and exit, with no stop, target or filter. The search tried 1,024 candidates on NQ daily bars from 2019-01-02 to 2025-06-30, long and short, one contract, and kept one of them for its return against its drawdown. The numbers are that kept candidate's.

Source: AlphaPrime product engine (CPU), run 2026-10-31. NQ daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $10 slippage per trade.

NumberResult
Net profit (closed trades)$249,575
Max drawdown$93,215
Trades60
Win rate60%
Profit factor1.828
Average trade$4,159.58
Time in market92.48%
Five steps in order: write the split date and pass rule, search fast and slow lengths in sample, freeze the pair, run it unchanged out of sample, then judge the average trade after costs against the rule. Settings only flow forward. Out of sample: run it once Five steps, in this order 1 2 3 4 5 Write rule Search IS Freeze Run OOS Judge No step goes back The pass rule comes before the search. So: judge the result, don't tune it.
The equity curve and drawdown of the kept candidate, with the out-of-sample stretch marked. Look at how much of the climb comes from a few long stretches, how deep the drawdown runs between them, and whether the slope after the out-of-sample marker resembles the slope before it. NQ · daily · 2019-01-02 to 2025-06-30 · CPU engine backtest

Read it as a shape, not a promise. Sixty trades over about six and a half years is fewer than ten a year, and the rule was in the market 92.48% of the time, which is what a slow trend rule does: it is almost always positioned and it reverses rarely. A max drawdown of $93,215 against a net profit of $249,575 says that more than a third of the whole gain was given back at least once, the "large giveback" from the pairs table. The profit factor of 1.828 and the win rate of 60% come from 60 trades, a sample in which replacing three or four trades would move both figures noticeably.

Two things flatter these numbers. The candidate was picked after the fact as the best of 1,024 by return against drawdown, so part of what it shows is selection, exactly the inflation the previous section described. And the stand-in rule is not the EMA crossover you would trade. Neither the Momentum rule nor any EMA pair earned this money in a sense a reader can expect to repeat; the run shows the character of a daily trend rule on this market after $30 of costs per trade, and that character is what an EMA crossover test on NQ daily bars should be compared against.

Do the best EMA settings differ by market?

Yes: index futures, gold, crude oil and TAIEX futures trend for different lengths of time and carry different costs relative to their daily range, so a pair that reaches a plateau on NQ must be tested again on each market rather than copied across. A moving-average length is a bet on how long a move persists. A market whose moves run for months rewards long lengths; a market whose moves reverse within days punishes them with giveback and rewards shorter ones, if the costs allow.

Two numbers describe a market for this purpose, and both are measured on your own data rather than assumed:

  • Trend persistence: how many bars a move typically runs before it reverses by more than its usual daily swing. Longer persistence favours slower pairs.
  • Round-trip cost relative to daily range: commission plus slippage in points, divided by the average daily range in points. The smaller this share, the shorter a pair can go before costs eat the average trade.
MarketTrend persistence (starting hypothesis)Round-trip cost ÷ daily range (starting hypothesis)Test to run
NQLongLowDaily plateau check first; intraday pairs only if a daily pair survives
ESLongLowSame order; expect slower pairs than NQ to look alike
GC (gold)MediumMediumDaily plateau check; rerun with doubled slippage
CL (crude oil)Short to mediumMediumDaily plateau check; expect more whipsaw than index futures
TAIEX futuresMediumCheck on your own dataDaily plateau check on day-session and full-session bars separately
Starting hypotheses per market: NQ and ES long trends and low cost share, gold medium and medium, crude oil short to medium trends and medium cost, TAIEX futures medium trends with the cost share to check on your own data. Each market gets a daily plateau check first, intraday only if the daily pair survives. Retest the pair per market Starting hypotheses, not findings Market Trend length Cost ÷ range NQ Long Low ES Long Low GC Medium Medium CL Short–med Medium TAIEX Medium Check yours Daily plateau first, every market. So: intraday only if daily survives.
Why the same EMA pair cannot be copied across markets: trend length and cost share differ, so each market gets its own daily plateau check before any intraday pair is tried.

The labels in the table are a starting hypothesis to confirm, not a finding. The order of tests is the part that transfers: run the daily grid with costs on each market, look for a plateau, grade the plateau's centre out-of-sample against your pre-written line, and only then try an intraday pair on the markets where the daily pair survived. Exchanges change tick sizes, fees and session hours from time to time, so take the cost inputs from the exchange's contract page for the market you test, and check them again before a live test.

The next step is one grid. Take the market you trade, daily bars, fast lengths 8 to 60 and slow lengths 20 to 240 in steps, with your real commission and one tick of slippage per side, and write down the pass line before you press run. Then look for the flat region, not the dark cell.

Frequently asked questions

What is the best EMA setting for day trading futures?

There is no setting that holds up across markets, and fast pairs on intraday bars are the most likely to fail after costs because each cross captures only a few ticks. Test the pair you have in mind on a grid of neighbouring lengths with commission and slippage included, and keep it only if the neighbours behave alike and the out-of-sample average trade stays positive. If no plateau appears on intraday bars, test the same rule on daily bars before giving up on it.

Should I enter at the cross or wait for the bar to close?

Read the signal at the bar close and fill on the next bar. The two averages are only final when the bar has closed, so an entry at the close itself uses a price that did not exist when the decision was made. Backtests that fill on the signal bar's close look better than any live account can, and the difference grows with faster pairs.

Can a filter stop the EMA crossover from being whipsawed?

A filter such as a minimum distance between the averages, a volatility band or a higher-timeframe trend condition reduces the number of crosses taken in a sideways stretch. It also delays or skips some real trend entries and adds parameters that can be curve fitted. Treat the filtered rule as a new candidate: test its neighbours and grade it on data the filter's settings never saw, following the split described in in-sample vs out-of-sample.

How many trades does a 50/200 EMA crossover produce?

On daily bars a 50/200 pair crosses a few times a year on most futures markets, often fewer. That means ten years of history may hold only a few dozen completed trades, too few for the average trade to be stable on its own. Judge such a pair across several markets and with the sign of each out-of-sample window, rather than from one market's total.

References

  • Brock, W., Lakonishok, J., & LeBaron, B. (1992). Simple Technical Trading Rules and the Stochastic Properties of Stock Returns. The Journal of Finance, 47(5), 1731–1764.
  • Sullivan, R., Timmermann, A., & White, H. (1999). Data-Snooping, Technical Trading Rule Performance, and the Bootstrap. The Journal of Finance, 54(5), 1647–1691.
  • Park, C.-H., & Irwin, S. H. (2007). What Do We Know About the Profitability of Technical Analysis? Journal of Economic Surveys, 21(4), 786–826.
  • Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.