An EMA crossover compares two exponential moving averages with different lookback lengths. A shorter average responds faster to recent prices. Their crossing can define a testable signal, but a complete strategy also needs execution, exit and risk rules.
How the EMA is calculated
Using closing prices and the common smoothing factor, α = 2 / (N + 1), each new EMA combines the latest close with its previous value. N is the number of bars, not necessarily days. Record the price source, timeframe, initialization and warm-up history so calculations can be reproduced across platforms.
EMA(t) = α × close(t) + (1 − α) × EMA(t − 1)
α = 2 / (N + 1)
A worked 9/21 crossover example
An upward cross occurs when the fast EMA was at or below the slow EMA on the previous bar and is above it on the current bar. Suppose the previous EMA(9) is 100, the previous EMA(21) is 100.20 and the new close is 102. The updated values are 100.40 and approximately 100.3636: an upward cross. A downward cross uses the reverse inequalities. These invented inputs explain the calculation; 9/21 is not an optimized setting or a return claim.
Turn the signal into explicit trading rules
Specify whether a cross is evaluated at bar close, when an order can fill, whether the system is long-only or long/short, and how an opposite signal affects an open position. Define sizing, exposure limits and exits separately. An intrabar cross may disappear before the bar closes. Moving averages lag price, and sideways periods can produce repeated reversals.
What to check in a backtest
Keep the data window, instrument universe and configuration alongside each run. Model fees, slippage and, where applicable, funding. Inspect drawdown, exposure, trade count and different market regimes alongside returns. Reserve an out-of-sample period before selecting settings, then investigate sensitivity and new data. Use only information available at each simulated decision; a historical test is not evidence of a guaranteed live outcome.
Explore the reporting workflow in QuantDesk
The QuantDesk demo lets you inspect saved CMA UBS and CMA ULTIMATE GUARD backtests through equity, drawdown, monthly results and trade records. Those records are not results for the illustrative EMA crossover described here. Use them to explore how a report can be examined, then discuss your own algorithm specification, testing scope or platform deployment with CMA Technologies.
A crossover is a precise event. Its usefulness belongs to the complete strategy, the test assumptions and the evidence that survives further testing.