# Moving Average Trading Strategies (Backtest) – What Is The Best MA?

Last Updated on May 24, 2023

How to use **moving average trading strategies **are widely discussed and used in the media and likewise frequently used by analysts when making calls about the future. What is a moving average and can we find profitable moving average strategies on stocks? **Do moving average strategies work?**

**Backtests reveal that the most popular moving averages work best for short-term mean reversion and long-term trend-following. However, moving averages serve many purposes, for example as trend filters or for other indicators and strategies. We conclude that the two most used and known moving averages are the best: the simple moving average and the exponential moving average.**

In this article, we discuss moving averages, and how you can use them in trading, we test some moving average strategies, and we provide links/articles to 20 different types of moving averages. However, we believe

**moving averages**were much more useful in the past before the personal computer came about. As the markets have become faster and more efficient, the usefulness of

**moving average strategies**has slowly eroded somewhat. Despite this, we find value in “classical” moving averages like the death cross or the 200-day moving average.

Let’s get started:

## What is the best moving average? A comparison and backtest of all MAÂ´s.

Over the years we have backtested all moving averages there are. There are plenty of moving averages to choose from, but which are good and bad? Here is a list of the ones we will backtest and look at the historical performance in trading strategies in this article. We use multiple settings in all of our backtests.

### Simple moving average (backtest and performance)

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 trading 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 the 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.

### Exponential moving average (backtest and performance)

There are different kinds of moving average indicators, and 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? What are the best settings?

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.

### Hull moving average (backtest and performance)

Experienced traders know that the best trading indicators are those that can reduce lag, eliminate noise, and quickly respond to sustained market changes. The Hull Moving Average (HMA) seems to tick those boxes. What do you know about the indicator? Is it possible to find profitable Hull moving average strategies?

Yes, Hull moving average strategies do work. Our backtests show that a hull moving average can be used profitably for both mean-reversion and trend-following strategies on stocks depending on the time frame.

Developed by Alan Hull in 2005, the Hull Moving Average (HMA) indicator is a combination of weighted moving averages (WMAs) that prioritizes recent price changes over older ones. It is a directional trend indicator, which tries to capture the current state of the market and uses recent price action to determine if conditions are bullish or bearish relative to historical data. The indicator attempts to minimize the lag of a traditional moving average while retaining the smoothness of the moving average line.

### Linear-weighted moving average (backtest and performance)

Moving averages are a technical analysis tool that smooths price data over a specific period. They come in different types, and each type has its advantages and limitations. The linear-weighted moving average is one of the common ones. But do you know what it is? And do you know if a linear-weighted moving average works? What are the best settings?

Yes, linear-weighted moving average strategies do work. Our backtests show that a linear-weighted moving average can be used profitably for both mean-reversion and trend-following strategies on stocks.

The linearly weighted moving average (LWMA) is a moving average that puts more weight on recent price data in a linear fashion: the most recent price has the highest weighting, with each prior price getting progressively less weight. As a result, for any given period, the LWMA reacts more quickly to price changes than a simple moving average (SMA) and an exponential moving average (EMA).

### Adaptive moving average (backtest and performance)

We know that traditional moving averages smoothen price series to reduce noise and show the trend. However, when price makes a temporary but significant leap, it can still give the appearance of a false trend. This is why Perry J. Kaufman invented the adaptive moving average. But what is it? Can we make profitable adaptive moving average strategies in the markets?

Yes, adaptive moving average strategies do work. Our backtests show that an adaptive moving average can be used profitably for both mean-reversion and trend-following strategies on stocks.

The adaptive moving average (KAMA) is a moving average designed to account for changes in market volatility. The indicator closely follows prices when the price swings are relatively small (less volatility or noise) and adjusts to follow the prices less closely when the price swings widen. In essence, the adaptive moving average works like a slow-moving average, as it reduces the influence of outliers, without sacrificing the sensitivity.

### Smoothed moving average (backtest strategy)

The smoothed moving average is not as common as other moving average indicators, but you will come across it in your trading journey. So, itâ€™s good to know what it means. Can a smoother moving average be used profitably in the stock market?

Yes, smoothed moving average strategies do work. Our backtests show that a smoothed moving average strategy can be used profitably for both mean-reversion and trend-following strategies on stocks.

The smoothed moving average (SMMA) is simply a moving average that assigns weight to price data points over a long period. The indicator takes all prices into account and uses a long lookback period. Although old prices are never removed from the calculation, they have only a minimal impact on the moving average because they are assigned low weight.

### Variable moving average (backtest strategy)

Traders have always looked for ways to improve the performance of exponential moving average, and using a volatility index (VI) to adjust the smoothing period as market conditions change has given rise to the variable moving average. But do you know what it is? And do you know if a variable moving average strategy works? What are the best settings?

Yes, variable moving average strategies do work. Our backtests show that a variable moving average can be used profitably for both mean-reversion and trend-following strategies on stocks.

A variable moving average (VMA) is an exponential moving average (EMA) that can automatically regulate its smoothing percentage based on market volatility. The idea behind the VMA is to dynamically adapt a moving average to a trendâ€™s volatility. Its sensitivity improves by assigning more weight to the ongoing data, thereby generating a better signal for short and long-term markets.

### Weighted moving average (backtest strategy)

Some simply call it weighted moving average, while others call it linearly weighted moving average. They are referring to the same indicator, which is one of the most popular and widely used MA indicators on most trading platforms. But what is it? And do you know if a weighted moving average strategy works? What are the best settings?

Yes, weighted moving average strategies do work. Our backtests show that weighted moving average can be used profitably for both mean-reversion and trend-following strategies on stocks.

As the name implies, the weighted moving average puts more weight on recent data and less on past data. This is done by multiplying each periodâ€™s price by a weighting factor that decreases linearly you move from recent to old data. Given this unique calculation, the WMA will follow prices more closely than a corresponding simple moving average.

### Zero lag exponential moving average (backtest strategy)

The moving average is no doubt one of the most widely used technical indicators. While there are different traditional types, many variations are being created all the time to improve on the old versions. The zero-lag exponential moving average is one of the improved versions of the exponential moving average. But do you know what it is? Can we make profitable zero-lag exponential moving average strategies in the markets?

Yes, zero-lag exponential moving average strategies do work. Our backtests show that a zero-lag exponential moving average can be used profitably for both mean-reversion and trend-following strategies on stocks.

The zero-lag exponential moving average (ZLEMA) is a type of exponential moving average that seeks to reduce the inherent lag seen in a typical moving average. It was designed to track the price more closely and give a clearer view of the trend with no lags.

### Volume weighted moving average (backtest strategy)

Several indicators are used for technical analysis; some of these indicators combine different market data to tell a better story about what the market is doing. The volume-weighted average price (VWAP), which combines both volume and price data, is one such indicator. But what is it? Can we make profitable volume-weighted moving average strategies in the markets? What are the best settings?

Yes, volume-weighted moving average strategies do work. Our backtests show that a volume-weighted moving average can be used profitably for both mean-reversion and trend-following strategies on stocks.

The volume-weighted average price (VWAP) is an indicator that traders use to determine the average price that a financial instrument has traded, based on volume and price. The volume-weighted average price is calculated by multiplying the sum of price and volume, then dividing the result by the total volume. VWAP is important because it provides traders with insight into the trend and its strength.

### Triple exponential moving average TEMA (backtest strategy)

One of the not-so-common moving average indicators used by traders is the triple exponential moving average (TEMA). It is an important trend indicator used by traders to identify trends more closely than a traditional moving average. But do you know what it is? And do you know if a triple exponential moving average strategy can be used profitably in the stock market?

Yes, triple exponential moving average strategies do work. Our backtests show that a triple exponential moving average can be used profitably for long-term trend-following strategies on stocks.

The triple exponential moving average, TEMA, is a trend following indicator used by analysts. It is formulated by creating multiple exponential moving averages (EMA) of the original EMA to reduce some of the lag. It helps to reduce price volatility to make the trend easier to identify.

### Variable Index Dynamic Average (backtest strategy)

Over the years, chartists have developed indicators to help them analyze the market better. While there are many of these indicators, a few stand out for their usefulness. One of such is the Variable Index Dynamic Average. Do you know what it is? Can we make profitable Variable Index Dynamic Average strategies in the markets? What are the best settings?

### Triangular moving average (backtest strategy)

Moving averages are the most common and useful technical indicators in forex trading, owing to their effect in smoothening out price movements and showing the actual direction of the trend. There are various types of moving averages. Apart from the common ones you know, such as the Simple Moving Average (SMA) and Exponential Moving Average (EMA), there is also the Triangular Moving Average (TMA) â€“ the moving average we cover in this article. But do you know what it is? And do you know if a simple average works to trade profitably in the markets? What are the best settings?

Yes, triangular moving average strategies do work. Our backtests show that a triangular moving average can be used profitably for both mean-reversion and trend-following strategies on stocks.

Triangular moving averages are similar to the simple moving average (SMA). It can provide a smooth line like the simple moving average. However, the triangular moving average is averaged twice to create an extra smooth and steady average line.

### Guppy multiple moving average (backtest strategy)

Trend traders are always looking for trading opportunities by analyzing the price chart. This includes spotting a trend early as well as knowing when a reversal is about to occur. Interestingly, the Guppy Multiple Moving Average can be helpful in that aspect. But do you know what it is? Can you make profitable Guppy multiple moving average strategies in the markets? What are the best settings?

The Guppy multiple moving averages indicator shows one of the lowest returns for crossovers among the different moving averages, but the long-term average gains per trade show decent returns close to 9% per trade.

The Guppy Multiple Moving Average, GMMA, is a technical indicator that uses moving average ribbons to provide a potential sign of a breakout in the price of a security. It uses multiple exponential moving averages (EMAs) to capture the difference between the current price and the average price over different periods. A convergence of the moving averages is associated with a significant trend change.

### McGinley Dynamic (backtest strategy)

Different types of moving averages are used in technical analysis. However, the McGinley Dynamic indicator stands out for its attempt to solve a problem inherent in moving averages that use fixed time lengths. Itâ€™s a type of moving average that is designed to improve existing moving averages. But do you know what it is? Can we make profitable McGinley Dynamic strategies in the markets?

Yes, McGinley Dynamic Indicator (moving average) strategies do work. Our backtests show that a McGinley Indicator (moving average) can be used profitably for both mean-reversion and trend-following strategies on stocks.

The McGinley Dynamic indicator is a moving average that was invented by John R. McGinley, a renowned market technician, to track the market. It is a better indicator than most moving average indicators as it improves upon moving average lines by adjusting for shifts in market speed.

### Geometric moving average GMA (backtest strategy)

There are different ways of getting the moving average of a time series. While the simple and exponential methods of calculating the moving average are more common in the trading world, it is also possible to get the geometric mean of the price series. But what does the geometric moving average entail? Can we make profitable geometric moving average strategies in the markets? What are the best settings?

Yes, simple moving average strategies do work. Our backtests show that a geometric moving average can be used profitably for both mean-reversion and trend-following strategies on stocks.

The geometric moving average is a type of moving average that calculates the geometric mean of the previous n-periods of the price time series. Unlike the simple moving average that uses the arithmetic mean to continuously calculate the moving average as new price data comes in, the geometric moving average uses the geometric mean formula to get the moving average of the price data as new ones come in. Since the geometric mean has a compounding effect, investors usually consider it a more accurate measure of returns than the arithmetic mean.

### Fractal adaptive moving average FRAMA (backtest strategy)

Many new forms of moving averages have been created, but not all of them are easy to calculate. The fractal adaptive moving average is one of those unique moving averages, but it offers great prospects. Letâ€™s take a look to find out what it is. Can we make profitable fractal adaptive moving average strategies in the markets? What are the best settings?

Yes, simple moving average strategies do work. Our backtests show that a simple moving average can be used profitably for both mean-reversion and trend-following strategies on stocks.

The fractal adaptive moving average (FRAMA), developed by John Ehlers, is an intelligent and adaptive moving average that takes advantage of the fact that price movements assume the fractal configuration and, as such, dynamically adjust its lookback period based on this fractal geometry. It follows price closely when there are significant moves while remaining flat if the price ranges.

### Fibonacci moving averages (backtest strategy)

Moving averages are one of the most useful technical indicators. This is because they are simple and flexible while offering useful information about the trend, as well as support and resistance zones. There are many types of moving average indicators, but in this post, we will be looking at the Fibonacci moving average. What it is? Can we make profitable Fibonacci moving average strategies in the markets?

Fibonacci moving averages are difficult to calculate, and we only find them valuable when using long-term moving averages.

The Fibonacci moving average (FMA) is a type of moving average that calculates many exponential moving averages using lookback periods from the Fibonacci sequence on both highs and lows to form a dynamic support/resistance zone. It works like a typical moving average but tends to provide more support/resistance reaction zones.

### Double exponential moving average (backtest strategy)

Traders are always looking for an edge in the market. While some employ the use of chart patterns, others simply trade based on indicators. An example of such an indicator is the double exponential moving average (DEMA). But do you know what it is? And is it possible to develop profitable double exponential moving average strategies?

Yes, double exponential moving average strategies do work. Our backtests show that a double exponential moving average strategy can be used profitably for both mean-reversion and trend-following strategies on stocks.

**The best strategies can be found in our….**

## Strategy Shop

Backtested trading strategies

The double exponential moving average (DEMA) is not as commonly used as the other types of moving averages. The DEMA gives more weight to the most recent price. This weighting results in a more reactive moving average, which is useful to short-term traders to profit from the market.

### Moving average slope (backtest strategy)

Finding good signals in the random chaos called the financial market is not an easy job and as such, one has to seek out every possible way to analyze the markets. In the search for an edge in the market, people create more indicators from existing ones. One of such derivative indicators is the moving average slope. And now, you may be wondering what that is. You might also wonder how you can make profitable moving average slope strategies in the markets? What are the best settings?

Yes, moving average slope strategies do work. Our backtests show that a moving average slope can be used profitably for both mean-reversion and trend-following strategies on stocks.

The moving average slope is an indicator created by subtracting the moving average level n-periods ago from the current moving average level and dividing by the time interval. For instance, you can get a 5-day slope of a 50-day simple moving average of the daily closing price by subtracting the value of the 50-day moving average 5 days ago from todayâ€™s value of the same 50-day moving average and dividing the difference by 5 days. The indicator is a great attempt at spotting when the price might be about to change direction by studying the strength (momentum) of the moving average.

Did we miss one of your favorite moving averages? Let us know and we will add it.

One thing we learned from all these tests is above all one thing: The best moving averages are the simple moving average and the exponential moving average. They also happen to be the easiest, simplest and most preferred. Moreover, moving averages also work best in longer time frames, preferably on daily bars and candlesticks. This means that day trading is not optimal for moving averages, but swing trading is.

What do we base our conclusion on? It’s based on our experience and backtests for each moving average. You find a complete list of all moving averages with links at the end of the article.

## What is a moving average?

First, we need to establish what a moving average is. It might be obvious to most readers, but our experience is that traders’ mathematical abilities are poor.

So what is a moving average? Below are the two most used moving averages: simple moving average and exponential moving average. Let’s start with the simplest and most used:

### Simple moving average (SMA)

A simple moving average is an average of a time series of numbers that adds observations to the average as time goes by, while the last numbers in the time series get excluded from the calculations. Here is an example of an average of ten observations:

10, 9, 11, 13, 5, 6, 7, 9, 3, 2

To find the average, you add all the numbers together (which is 75) and divide by the number of observations (10). Thus, the average is 7.5.

As we add observations, the calculation change:

**10, 9,** 11, 13, 5, 6, 7, 9, 3, 2, 13, 8

The above sequence has two more observations, and the two first observations in bold are excluded from the calculation.

The above is called a simple moving average. A simple average puts equal weighting on all observations. However, if you don’t want to put equal weightings on all observations, you can use an exponential moving average:

### Exponential moving average (EMA)

Perhaps the second most used moving average is the exponential moving average.

Opposite to a simple moving average, an exponential moving average puts more weight on the most recent observations and the calculations are a bit more cumbersome than a simple moving average. As a result of this method of calculating the average, the EMA will follow prices more closely than a corresponding SMA.

If you want to go into more detail about the EMA, we recommend our separate article about the EMA where we also backtest exponential moving average strategies.

### The visual differences between the SMA and EMA

The difference between the averages looks like this:

The 50-day EMA reacts faster than the SMA, clearly indicated in the chart above, precisely EMA’s aim.

## What is the best time frame for moving averages?

There is, of course, no best time frame for a moving average. You can’t possibly fit a one-time time frame into a lot of different markets. Moreover, results vary from market to market (from asset class to asset class).

However, as a general rule, stocks are mean revertive in the short term and trending in the long term. Thus, mean-reversion works well on short moving averages, meaning you can buy when the close crosses below the moving average and sell when it closes above the moving average. This strategy works pretty well for less than 15 days.

At the same time stocks tend to move up in the long-term due to inflation and productivity gains, and this is a case for trend-following. Further down in the article we have a list of both different moving averages and examples of **moving average stategies**.

## Are the moving averages good indicators?

Moving averages are extremely popular among traders. This must indicate they are very beneficial?

Well, it depends. We have mixed results depending on both the time frame and asset class. As mentioned above, moving average strategies are good for many assets as short-term contrarian (mean-reversion) strategies, and moving averages are a handy tool to define trends in the market.

For example, the Lucas Management Trend-Following Index (MLM Index) uses only a simple moving average to construct an index for trend following in certain commodities (can it get any simpler than that?). The index has shown very good risk-adjusted returns for many decades. We covered this in an article about does trend following work?

## How do you use moving averages?

In this section, we briefly list the most common uses of the averages:

### Moving average crossover strategies

Traders are often introduced to moving averages when learning technical analysis, as they are some of the most common indicators. While there are many ways to use moving averages, the moving average crossover strategy is one of the easiest to learn and use. But what is the strategy about?

The moving average crossover is simply a trading strategy the crossing of one moving average over another to generate trading signals. For example, when a short-period moving average crosses above a long-period moving average, a buy signal is generated, and when it crosses below, a sell signal is generated.

A moving average crossover can also refer to a point on a price chart where a short-period moving average crosses above or below a long-period moving average. When the short one crosses above the long one, it is called a golden cross and is often seen as a buy signal. On the flip side, when the short one crosses below the long one, it is called a death cross and is often seen as a sell signal.

All types of moving average indicators, such as the EMAs, SMAs, LWMAs, and so on, can be used for this strategy. Even a combination of different types can be used. Whichever the case, the rules for entry and exit are usually the same.

Moving averages make it easier to view trends while smoothing out volatility. The moving average crosser strategy tries to show when the trend is changing direction. The faster, short-period moving average reacts faster to changes in price direction and, as such, follows the price more closely than the long-period moving average. This is just one of many ways you can define trends, though.

Moving averages are available across multiple trading platforms and are always easily available. You can simply search for any moving average indicator you want on your platform and attach two of them to your chart. Then select the period settings you want for the moving averages.

Below is an example of a moving crossover (the 50-day moving average crosses below the 200-day moving average):

The pitfall of the moving average crossover lies in the moving average itself (as with all moving averages). All moving averages are plagued by the lag factor because they make use of past price data.

### Moving averages and trend-following:

This is a label that, just like most of the trading topics, is loosely defined. What exactly is trend-following? We use the definition in Curtis Faith’s *The way of the Turtle* (page 22):

In trend-following, the trader attempts to capitalize on large price movements over the course of several months. Trend followers enter the trades when markets are at historical highs or lows and exit when a market reverses and sustains that movement for a few weeks.

Curtis Faith was part of the famous Turtle experiment in the 1980s. Below are some of the strategies mentioned in his book *The Way of The Turtle*:

**Donchian trend:**Entry is done when the price sets a 20-day high and when an exponential moving average of 25 days is above the 350-day average. The exit is when the 25-day EMA crosses below the 350-day EMA.**Dual moving average:**Go long when the 100-day SMA crosses above the 350-day SMA. Opposite for short (which is also the exit for longs). Thus, the strategy is always in the market.**Triple moving average:**Buy when the 150-day SMA crosses above the 250-day SMA, but only when both averages are above the 350-day SMA. Exit when the 150-day SMA crosses below the 250-day SMA.

These strategies are easy to test. We tested on several ETF’s and the result is like this:

**Donchian Trend**: The S&P 500 has 9 trades since 1993 and returned a CAGR of 8.3% with 86% of the time invested. The drawdown was slightly better than buy and hold. Gold returned 5.81% vs. 8.6% for buy and hold but with slightly less drawdown. We tested only longs.**Dual moving average:**For all our ETFs, the strategy is inferior to buy and hold with small improvements in the maximum drawdown.**Triple moving average:**Same results as for the dual moving average.

Trend-following works best for commodities, like sugar, coffee, cotton, gasoline, etc. We have never found any value in trend strategies related to stocks or the stock market unless you use a very long time frame of at least 100 days. On the contrary, mean-reverting strategies work best on stocks, like for example this strategy:

### Moving averages and support and resistance:

A pretty common feature is to use moving averages as support and resistance levels, which is often of great interest for analysts in the media. Unlike support and resistance in classical technical analysis, the support and resistance of moving averages are dynamic: they change.

Let’s find out if there is any value in MAs and support:

- Entry is when either the close or today’s low penetrates the moving average. Entry is the closing price.
- We exit when today’s close is higher than yesterday’s high.

We test for a wide range of days in the moving average: from 5 to 250 days with 5-day intervals. In Amibroker the code is like this:

MAdays=Optimize(“MAdays”,50,5,250,5);

Buy= Cross(MA(C,MAdays),Close) OR Cross(MA(C,MAdays),Low);

buyPrice=Close;

Sell= Close>Ref(H,-1);

sellPrice=Close ;

In the S&P 500, the best results are in a cluster of around 100 days. However, the results are not pretty good. The best result is an average of 80 days, which returns a 3.8% CAGR, less than half the buy and hold. For other ETFs, the result is even worse.

What happens if we add another criterion? Let’s add that the Relative Strength Indicator must be lower than 30:

Buy= ( Cross(MA(C,80),Close) OR Cross(MA(C,80),Low) ) AND RSI(2)<30;

buyPrice=Close;

Sell= Close>Ref(H,-1);

sellPrice=Close ;

The results are pretty good: CAGR is 3.41% but with many fewer trades:

Unfortunately, it’s not the moving average crossover that makes the strategy decent, but the RSI.

### Moving averages and profit targets:

One other use of moving averages is to use them as profit targets or stop-losses. For example, when a price hits a moving average, you exit the trade. We find many strategies on the internet that use this kind of target, but we have never managed to find them much useful except for short-term exits based on strength.

### Moving averages and stop-losses:

If you buy above a moving average, you can use the same moving average as a stop-loss. Thus, you are using a dynamic stop loss because the moving average obviously fluctuates with the price of the instrument you are trading. It’s normally trend-following strategies that use averages as stop-losses.

### Moving averages as filters:

Moving averages are mostly used as a filter for other indicators or variables. For example, if the S&P 500 is above the 200-day moving average, it’s bullish, and bearish if it’s below the average. Some analysts claim markets show different price behavior depending on where the price is compared to a certain moving average. Do quantified tests verify this? Let’s do some testing:

The table below shows the average gain in percent in the S&P 500 from close to close when it’s over or below the n-day moving average:

SPY | Above | Under |

5-day | 0.02 | 0.09 |

10-day | 0.02 | 0.09 |

25-day | 0.03 | 0.08 |

50-day | 0.03 | 0.08 |

100-day | 0.03 | 0.07 |

200-day | 0.04 | 0.05 |

GLD | Above | Under |

5-day | 0.04 | 0.04 |

10-day | 0.05 | 0.02 |

25-day | 0.04 | 0.04 |

50-day | 0.03 | 0.05 |

100-day | 0.04 | 0.05 |

200-day | 0.05 | 0.03 |

The first row indicates the S&P 500 has a 0.02% average return from the close of today until the close of tomorrow when the close today is below the 5-day simple moving average. Clearly, the S&P 500 performs the best when it’s below the average. The index is clearly mean-revertive. Below is the equity curve when the S&P 500 is below the 5-day average:

The equity curve when the S&P 500 is above the 5-day average looks like this:

Opposite, gold shows slightly different tendencies where long-term trends are more prevalent.

## Death cross indicator (two moving averages):

The Death Cross is frequently mentioned in the media. What is it?

The indicator’s logic is as follows: when a short-term moving average crosses below a long-term moving average, we can expect lower prices, hence the name “death”. Usually, a 50 and 200-day moving average is used.

A death cross is when these two moving crossovers indicate a possible imminent bear market, and is the opposite of a golden cross. The Death Cross, a rather gloomy title, is frequently mentioned by pundits in the financial media, and, perhaps surprisingly, it does serve as a somewhat useful trading indicator or strategy.

## Golden crosses (moving averages):

A golden cross is the opposite of a death cross – when a short term moving average crosses above a longer moving average. Normally, the 50-day and 200-day moving averages are used.

## Can you use moving averages in indicators?

Yes, some indicators are based on moving averages:

### MACD is based on moving averages:

MACD is an abbreviation for Moving Average Convergence Divergence. The indicator uses two moving averages: typically, it’s a 12-day and 26-day period. We have no idea why these days are used, but you can change to whatever time frame you prefer. The MACD is the difference between the two averages and oscillates around zero. Below is how it looks like on a chart:

Some years ago we made a strategy based on the indicator with promising results:

### Bollinger Bands are based on moving averages:

Another famous indicator is the Bollinger Bands, developed by John Bollinger. The indicator uses a moving average and adds two bands over and under two standard deviations away from the moving average. You can set the number of days to what you want, and likewise incorporate the size of the standard deviation as you please. The default standard deviation is normally two.

The Bollinger Band is a volatility filter. A standard deviation of two captures 95% of the past movement within those two bands. However, the assumption is that price action forms a normal distribution, which is often not the case, hence the expression “fat tails”, “tail risk“, etc.

Here is a chart with Bollinger Bands included:

## Other moving averages and moving average strategies

For your convenience, we have covered all moving averages with both detailed descriptions and backtests. This is our list:

- Simple moving average (backtest strategy)
- Exponential moving average (backtest strategy)
- Hull moving average (backtest strategy)
- Linear-weighted moving average (backtest strategy)
- Adaptive moving average (backtest strategy)
- Smoothed moving average (backtest strategy)
- Variable moving average (backtest strategy)
- Weighted moving average (backtest strategy)
- Zero lag exponential moving average (backtest strategy)
- Volume weighted moving average (backtest strategy)
- Triple exponential moving average TEMA (backtest strategy)
- Variable Index Dynamic Average (backtest strategy)
- Triangular moving average (backtest strategy)
- Guppy multiple moving average (backtest strategy)
- McGinley Dynamic (backtest strategy)
- Geometric moving average GMA (backtest strategy)
- Fractal adaptive moving average FRAMA (backtest strategy)
- Fibonacci moving averages (backtest strategy)
- Double exponential moving average (backtest strategy)
- Moving average slope (backtest strategy)

We have also published relevant trading moving average strategies:

- The 200-day moving average strategy
- Trend-following system/strategy in gold (12-month moving average)
- Trend following strategies Treasuries
- Is Meb Faberâ€™s momentum/trend-following strategy in gold, stocks, and bonds still working?
- Trend following strategies and systems explained (including strategies)
- Does trend following work? Why does it work?
- A simple trend-following system/strategy on the S&P 500 (By Meb Faber and Paul Tudor Jones)
- Conclusions about trend-following the S&P 500
- Why arithmetic and geometric averages differ in trading and investing

## Amibroker code for moving averages

We have provided code for all of the moving averages above in Amibroker and some in Tradestation. You can find most of the code on the link that contains most of our free trading strategies:

In the free articles, we have also many articles that show which indicator works best with moving average.

We receive enquires if we have python code, but unfortunately, we don’t.

We are also considering making a PDF file or e-book about our research at a future date. Please register your e-mail if you want to get more info about this or if you simply want to get trading related posts in your inbox.

## Moving average strategies in trading – main takeaway:

**Are moving average strategies good or bad**? All our backtests (also including the linked articles) indicate that short-term moving averages serve most use as a mean reversion or contrarian indicator. For long-term time frames, it’s the opposite: trend-following works best.

“A standard deviation of two captures 95% of the past movement within those two bands.”

That assertion should be tested. Hint: I tested it and it is not true for financial instruments…

ðŸ˜‰

Statistical knowledge required: this calculation depends on the numbers coming from a “stable population.”

Most 10-yr olds have a height that fits within this calculation, and you could readily predict if one was tall or short for that group of 10-yr olds. By the time the youngsters are 12-yrs old, their “population” is no longer stable, and the statistics have to be re-calculated.