Exponential Moving Average Strategy (EMA): Backtest and Evaluation

Exponential moving average strategy and backtest

The exponential moving average is one of the most commonly used among traders. But do you know what it is? And do you know if an exponential average strategy can be used profitably in the stock market?

Backtests indicate that exponential moving averages do work: They can be useful for mean-reversion strategies if you use a short number of days in the moving average, and useful for long-term trend following if you use a high number of days in the moving average.

Also referred to as the exponentially weighted moving average, the exponential moving average (EMA) is a type of moving average indicator that places a greater weight and significance on the most recent data points. Thus, it follows the price more closely than the simple moving average.

Exponential moving average strategy backtest and best settings

Right off the bat, we backtest four different exponential moving average strategies. If you want to understand what an exponential moving average is, you can read more about that after our backtests.

What are we trying to find out?

We want to know if an exponential moving average crossover system can be used profitably in trading systems. Can you make money using exponential moving averages?

We do our backtest on the most traded instrument in the world: the S&P 500. We test on SPDR S&P 500 Trust ETF which has the ticker code SPY.

Trading Rules

[am4show have=’p2;p3;p58;p59;p130;p138;’ user_error=’Premium Post Access’ guest_error=’Premium Posts’]

All in all, we do four different backtests:

  1. Strategy 1: When the close of SPY crosses BELOW the N-day moving average, we buy SPY at the close. We sell when SPY’s closes ABOVE the same average. We use CAGR as the performance metric.
  2. Strategy 2: Opposite, when the close of SPY crosses ABOVE the N-day moving average, we buy SPY at the close. We sell when SPY’s closes BELOW the same average. We use CAGR as the performance metric.
  3. Strategy 3: When the close of SPY crosses BELOW the N-day moving average, we sell after N-days. We use average gain per trade in percent to evaluate performance, not CAGR.
  4. Strategy 4: When the close of SPY crosses ABOVE the N-day moving average, we sell after N-days. We use average gain per trade in percent to evaluate performance, not CAGR.

[/am4show]

The results from the two first backtests are summarized in these two tables:

Strategy 1

Period

5

10

25

50

100

200