Simple Moving Average Trading Strategy: Backtest And Statistics

Table of contents:

Key Takeaways Statistics – Simple Moving Average Trading Strategy

  1. SMA Calculation Example: For Apple stock with closing prices of $10, $11, $12, $11, $14 over five days, the 5-day SMA would be calculated as ($10 + $11 + $12 + $11 + $14) / 5 = $11.6. This demonstrates the method of calculating the SMA, showing its responsiveness to price changes.
  2. Backtesting Performance Metrics: Strategy 1 with a 5-day SMA yielded an 8.34% Compound Annual Growth Rate (CAGR), while using a 200-day SMA under Strategy 2 resulted in a 7.89% CAGR. These figures highlight the effectiveness of different SMA periods in capturing market trends.
  3. Drawdown Comparison: The maximum drawdown (MDD) for a 200-day SMA was significantly lower at -28% compared to a 5-day SMA, which had a MDD of -32.61% for Strategy 1 and -66.05% for Strategy 2. This illustrates the risk associated with different SMA strategies.
  4. Short vs. Long-term SMA Strategies: Short-term SMA strategies (e.g., 5 days) are more profitable for mean-reversion with an 8.34% CAGR, while long-term SMA strategies (e.g., 200 days) are better for trend-following with a 7.89% CAGR but with half the drawdown of buy and hold (28% vs. 56%).
  5. Optimal Trade Duration: The highest average gain per trade was observed when buying after the price crosses above the 200-day SMA and holding for 200 days, which returned an average of 10.93% per trade, showcasing the potential long-term holding benefits.
  6. Indicator Comparison: The Simple Moving Average (SMA) and Exponential Moving Average (EMA) serve different purposes, with the EMA reacting more quickly to recent price changes. However, the preference between using a 200-day SMA or EMA depends on the trader’s strategy, with the SMA often preferred for its simplicity.
  7. Strategy Effectiveness Over Time: The effectiveness of SMA strategies has evolved, with backtests indicating profitable use of SMAs despite the increasing computational power and market efficiency. For instance, the 5-day and 200-day SMA strategies show clear profitability and risk management benefits, emphasizing the enduring relevance of SMA strategies in trading.

A Simple Moving Average (SMA) Trading Strategy involves using the SMA indicator to identify potential buy or sell signals based on the price of an asset relative to its average price over a specific period. To backtest this strategy, you would simulate how it would have performed on historical data by following predefined rules for entering and exiting trades when the price crosses the SMA. This process helps evaluate the strategy’s effectiveness before applying it to live markets.

Moving averages are one of the most commonly used indicators in technical analysis, and the simple moving average is the easiest one to construct. Do you know what it is? Can you make profitable simple moving average strategies in the markets? Backtests indicate that you can use simple moving averages for short-term mean reversion and long-term trend-following. Additionally, you can use moving averages as a second parameter in a trading strategy.

A simple moving average (SMA) is a basic average of the price of an asset over a specified period calculated continuously for any new price data that forms in the time series. Since the price data keeps changing for each session and the average is calculated for each new data, the average changes constantly, which is why it is called a moving average.

What is a simple moving average (SMA)?

A simple moving average (SMA) is a simple average of the price of an asset over a specified period. The average is called “moving” because it is calculated continuously for any new price data recorded in each new trading session and plotted on the chart bar by bar, forming a line that moves along the chart as the average value changes.

The SMA is one of the primary indicators in technical analysis and is usually the easiest moving average to construct, which is why it is referred to as the “simple” moving average. The indicator is present on all trading platforms.

To give you an example of what a simple moving average looks like, we use a screenshot from Amibroker:

Simple moving average trading strategy
This is what a 15-day simple moving average looks like: constant up and down.

As you can see, the close crosses up and down frequently by using a 15-day moving average. There are many whipsaws and thus the win rate is low.

How do you calculate a simple moving average?

The formula for calculating the SMA is quite simple.

SMA = (P1 + P2 + P3… + Pn)/n

So, it is just the average closing price of an asset over the last “n” periods. To calculate it, you sum the closing prices of the asset over the chosen number of periods and then divide the sum by the number of periods.

For instance, let’s assume that Apple closed at $10, $11, $12, $11, $14 over the last five days. The simple moving average of Apple stock (AAPL) would be calculated as $10 + $11 + $12 + $11 + $14 divided by 5, which is equal to $11.6.

As time moves on, the first observation is taken away and replaced with a new one. For example, on the sixth day we have these observations:

$10 + $11 + $12 + $11 + $14 + $15

To calculate a new 5-day moving average we will have to exclude the first observation ($10) and replace it with $15:

$11 + $12 + $11 + $14 + $15

Thus, the new 5-day moving average is $12.6

Why use a simple moving average?

All moving averages aim to show the direction of the trend, and the SMA does that easily. It shows the direction the price of a security is moving based on previous prices. If the simple moving average points up, this means that the security’s price is increasing. If it is pointing down, it means that the security’s price is decreasing.

Also, it smooths out volatility better than most other moving average indicators. When the averaging period is long enough, say 100-day MA or 200-day MA, the indicator line can serve as a potential support or resistance level.

How to use a simple moving average?

Every trading platform has a built-in simple moving average indicator. To use the indicator, you have to attach the indicator to the chart and adjust the settings to what you want. If you want the SMA to show a longer-term trend, you make the averaging period long, say 100 or 200. But if you want the indicator to follow the price more closely and show the short-term trend, you reduce the period to say 10 or 20.

You can use a simple moving average indicator to identify the price trend. If the SMA indicator line is pointing upward, with the price bars lying mostly above it, there is an upward trend, but if it is pointing downward, with the price bars lying mostly below it, there is a downward trend. When the SMA is flat, with the price swinging above and below it, the trend is sideways. The point is that you use the moving average purely mechanically by writing rules in your trading software.

Another thing you can do with the SMA indicator, especially a long-period (200-day SMA, for example) is to identify potential support and resistance levels. When the trend is upward, with the price bars lying above the SMA, the indicator line can serve as a potential support level. Likewise, when the trend is downward, with the price bars lying below the SMA, the indicator line can serve as a potential resistance level.

We have covered this in a separate article about moving averages.

Simple moving average strategy (backtest and best settings)

This website is all about quantified strategies, and we go straight to our backtests: what is the best use of a simple moving average? All in all, we test four different moving average crossover systems to find the best simple moving average strategy.

Trading Rules – Simple Moving Average

We backtest the following four different

THIS SECTION IS FOR MEMBERS ONLY. _________________ Click Here To Get A Trial Access Click Here To Get Access To Trading Rules

Strategy 1

MA Days

5

10

25

50

100

200

CAR

8.34

7.53

5.72

5.19

3.47

1.55

MDD

-32.61

-38.01

-39.89

-39.82

-50.96

-52.18

Strategy 2

MA Days

5

10

25

50

100

200

CAR

1.27

2.07

3.8

4.29

5.98

7.89

MDD

-66.05

-56.27

-48.42

-41.68

-50.82

-28

What conclusions can we draw from these two tables? The first thing that is quite obvious is that the stock market shows tendencies toward mean-reversion in the short run. This we can see in table one where it’s clearly much more profitable to buy when the close crosses below a short-term moving average than compared when it crosses above. The 5-day moving average returns a CAGR of 8.34% (which is pretty good). The buy and hold CAGR is 9%.

However, as the moving average gets longer, it turns upside down: then it’s getting more and more profitable to buy when the close crosses above the simple moving average. This means that trend-following strategies work best in the long term. The longer the average is, the better! The 200-day moving average returns 7.89%. We would say this is pretty good because the max drawdown is just half compared to buy and hold (28 vs 56%).

The last two backtests, 3 and 4, returned the following results:

Strategy 3

MA \ Bars

5

10

25

50

100

200

5

0.28

0.39

1.08

2.11

4

8.62

10

0.28

0.55

1.21

2.49

4.48

8.87

25

0.25

0.57

1.02

2.19

4.02

8.23

50

0.3

0.62

1.16

2.24

5.7

9.64

100

0.59

1.2

1.8

3.37

5.49

9.07

200

0.29

0.38

1.07

3.24

6.61

8.06

Strategy 4

MA \ Bars

5

10

25

50

100

200

5

0.22

0.23

0.86

2.26

3.75

8.92

10

0.23

0.44

0.92

1.96

4.09

9.3

25

0.26

0.37

1.01

1.42

4.01

7.62

50

0.06

0.15

0.46

1.35

4.36

9.14

100

0.3

0.43

1.36

2.47

5.35

7.3

200

0.24

-0.22

0.38

2.81

5.87

10.93

Tables 3 and 4 confirm what we found out in tables 1 and 2: longer you stay invested in stocks, the better the returns. The tailwind from inflation and productivity gains make sure of that.

The best result is if you buy when the close crosses above the 200-day moving average and hold for 200 days – slightly less than a year. This has returned an average of 10.93% per trade (dividend reinvested is not included thus understating the result.

The four tables are all moving average crossover systems. This is, of course, not he only way to test moving averages. Another useful tool can be to use a moving average as a trend filter. As an example, we recommend our pullback trading strategy.

Here you can find all our Moving average strategies.

How does the length of the period chosen for a Simple Moving Average (SMA) affect its sensitivity to price changes?

The length of the period chosen for a Simple Moving Average significantly affects its sensitivity to price changes. A shorter period SMA will be more sensitive to price changes because it reacts more quickly to recent price movements. Conversely, a longer period SMA smooths out price data over a more extended period, making it less sensitive to daily price fluctuations. This means that short-period SMAs are better for identifying short-term trends, while long-period SMAs are more useful for observing long-term trends.

Can the SMA of a stock ever be exactly zero, and under what circumstances?

The SMA of a stock can theoretically be exactly zero, but this scenario is extremely rare and would only occur in a situation where the stock’s price has closed at zero over the entire period of the SMA. Since most traded stocks do not have a price of zero (as stocks priced at zero would indicate a company with no perceived value or a delisted company), an SMA value of zero is practically impossible under normal trading conditions.

How does the starting point of an SMA calculation influence its value, especially in volatile markets?

The starting point of an SMA calculation can significantly influence its value, particularly in volatile markets. If the SMA starts during a period of high volatility, the average may be skewed by extreme values, leading to a less accurate representation of the overall trend. Conversely, starting the SMA during a period of low volatility might result in a smoother average that doesn’t fully capture subsequent market swings. The chosen starting point can thus impact the SMA’s effectiveness as a trend indicator.

In what ways can the SMA be misleading when used on stocks with seasonal or cyclical patterns?

The SMA can be misleading when used on stocks with seasonal or cyclical patterns because it does not account for the inherent fluctuations in such stocks. Seasonal trends can cause the SMA to indicate a trend that is not representative of the stock’s underlying pattern. For example, a rising SMA during a seasonal peak might suggest a long-term uptrend, while in reality, the stock may soon revert to its lower, off-peak prices. Similarly, cyclical patterns can lead to misinterpretation of the SMA during downturns or upswings that are part of a regular cycle rather than a long-term trend change.

How does the SMA compare to the exponential moving average (EMA) in terms of lag, and why might one be preferred over the other in certain trading strategies?

The SMA tends to have more lag compared to the Exponential Moving Average (EMA) because it assigns equal weight to all values in the period. The EMA reduces lag by giving more weight to recent prices, making it more responsive to new information. Traders might prefer the EMA for short-term trading strategies that require quick reactions to price changes. Conversely, the SMA might be preferred for long-term strategies that benefit from a smoother trend indicator, minimizing the impact of short-term volatility.

Can the SMA be effectively used on non-price data, such as trading volume or economic indicators, and what insights might it provide?

Yes, the SMA can be effectively used on non-price data, such as trading volume or economic indicators, to provide insights into trends and patterns. For instance, applying an SMA to trading volume can help identify trends in market participation, while an SMA on economic indicators like unemployment rates can offer a smoothed perspective on economic trends. These applications can help traders and analysts discern underlying trends in data that might be too volatile or erratic to interpret accurately on a day-to-day basis.

What are the implications of using an SMA in a market that is trending strongly in one direction versus a market that is range-bound?

Using an SMA in a market that is trending strongly in one direction can help confirm the trend’s direction and strength, as the moving average will slope upwards or downwards along with the trend. However, in a range-bound market, where prices fluctuate within a narrow band, the SMA may produce many false signals, indicating trends that don’t materialize because the price movement is primarily horizontal. This distinction highlights the importance of context when interpreting SMA signals and suggests that additional indicators might be necessary to confirm trends in range-bound markets.

How does the choice of the SMA period affect the frequency of trades in a systematic trading strategy?

The choice of the SMA period directly affects the frequency of trades in a systematic trading strategy. A shorter-period SMA will generate more trading signals because it reacts more quickly to price changes, potentially leading to a higher frequency of trades. In contrast, a longer-period SMA will produce fewer signals, as it takes more time for the average to react to price changes, resulting in fewer trades. Traders must balance the desire for responsiveness with the need to avoid excessive trading costs and the risk of overtrading.

In what scenarios might an SMA fail to provide accurate signals, and how can traders adjust their strategies to mitigate these issues?

An SMA might fail to provide accurate signals in scenarios of high market volatility or during the formation of price patterns that do not align well with the SMA period. For example, in a volatile market, the SMA may lag too much, providing signals too late for effective action. Traders can mitigate these issues by adjusting the SMA period to better match the current market conditions, using multiple SMAs of different lengths for confirmation, or incorporating other types of indicators (like volume or momentum indicators) to complement the SMA.

How do changes in market volatility affect the interpretation of the SMA, and should the length of the SMA be adjusted in response to these changes?

Changes in market volatility significantly affect the interpretation of the SMA. During periods of high volatility, an SMA may appear to lag significantly, as rapid price changes make the average less reflective of the current market state. Conversely, in low volatility, the SMA may smooth out price movements too much, masking potentially important trends. Traders might consider adjusting the length of the SMA in response to changes in volatility: shortening it during high volatility periods to make it more responsive, or lengthening it during low volatility periods to filter out noise. This adjustment helps maintain the SMA’s relevance as a trend-following indicator under varying market conditions.

What are the drawbacks with a simple moving average?

The SMA is a lagging indicator. The reason is that the SMA is constructed using past closing prices. Thus, it simply displays a previous trend, which may not be predictive of future prices. You can reduce the lag by reducing the period setting, but that can also lead to many false signals. As always, there are only trade-offs in trading, no guarantees!

What is the purpose of a SMA?

The purpose of a SMA is to provide an indication of the direction of a security’s trend and to help identify support and resistance levels.

What is the difference between a SMA and an exponential moving average (EMA)?

An exponential moving average (EMA) gives more weight to recent prices and less weight to historical prices than a SMA. As a result, an EMA will react more quickly to recent price changes than a SMA.

What is the best simple moving average?

There is no best or worst simple moving average. You need to backtest to find out what is the best time frame for each particular asset.

Is simple moving average a good indicator?

Yes, but our experience indicates it’s best as one of more parameters. For example, a simple moving average can be used as a trend filter. Please check out our pullback trading strategy.

How Do You Interpret a SMA?

The purpose of a SMA is to indicate the trend direction of a security and to identify potential support and resistance levels based on historical price averages. A rising SMA suggests an increasing price trend, while a falling SMA indicates a decreasing price trend. It serves as a visual guide for understanding the direction of a security’s price movement. A rising SMA indicates that the security’s price is increasing and a falling SMA indicates that the security’s price is decreasing.

Should I Use 200 SMA or EMA?

The key difference lies in weighting. EMA gives more weight to recent prices, reacting quickly to changes, whereas SMA treats all prices equally over a specified period. Both 200-day Simple Moving Average (SMA) and Exponential Moving Average (EMA) are used. However, the preference may vary, and in this context, the 200-day SMA is recommended. The 200-day moving average is a good indicator. We prefer to use the SMA and not the EMA.

Do Most Traders Use EMA or SMA?

While SMA is a valuable indicator, combining it with other parameters enhances its effectiveness. For example, it can be used as a trend filter in conjunction with other strategies. Both SMA and EMA are used, SMA is believed to be more commonly utilized by traders. The choice between the two often depends on individual preferences and strategies. We believe most traders use SMA. However, we believe SMA and EMA are not that different.

Relevant articles about moving averages strategies and backtests

Moving averages have been used for decades, perhaps even centuries.

Moving average strategies caught the interest of systematic trend followers in the 1970s when the first computers made computing easier.  One of the first to use moving averages was Ed Seykota. However we believe moving average strategies were much more powerful before the 1990s due to the rise of the personal computer. The most low-hanging fruit has been “arbed away”.

That said, our backtests clearly show that you can use moving averages profitably. But, as we have mentioned, there are plenty of different ways to use a moving average.

For your convenience, we have covered all moving averages with both detailed descriptions and backtests.

Conclusions

Our main takeaways from this exercise are that simple moving average strategies work well by buying when the close ends up below a short-term moving average and sell when it reverses and crosses above the same moving average.

Opposite, when you are using a long-term moving average, it’s best to buy when it crosses above the average and sell when it reverses and crosses below.

Similar Posts