Adaptive Moving Average – Trading Strategy Backtest (Does it work?)

Last Updated on May 21, 2022 by Quantified Trading

Adaptive moving average strategy backtest (Kaufman’s adaptive moving average)

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.

Does an adaptive moving average strategy work? We backtest different strategies

Before we go on to explain what an adaptive moving average is and how you can calculate it, we go straight to the essence of what this website is all about: quantified backtests.

Our hypothesis is simple:

Does an adaptive moving average strategy work? Can you make money by using adaptive moving averages strategies?

We look at 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.

All in all, we do four different backtests:

  • 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.
  • 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.
  • 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.
  • 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.

The results of the first two backtests look like this:

Strategy 1























Strategy 2























The results from the backtests are pretty revealing: in the short run, the stock market shows tendencies to mean-reversion. In the long run, it is better to use trend-following strategies.

Why do we reach that conclusion?

Because if we use a short moving average, the best strategy is to buy when stocks drop below the average and sell when it turns around and closes above the moving average (buy on weakness and sell on strength). This can clearly be seen in the first test above for the 5-day moving average in the first table. The 5-day moving average returns a CAGR of 8.53%, which is almost as good as buy and hold even though the time spent in the market is substantially lower.

When we buy on strength and sell on weakness, in the second test in the table above, the best strategy is to use many days in the average. The longer the average is, the better. The 200-day moving average returns 5.61%, which is pretty decent. Keep in mind that our backtest doesn’t include reinvested dividends.

The result from backtests 3 and 4 looks like this (the results are not CAGR, but average gains per trade):

Strategy 3



















































Strategy 4



















































As expected, the longer you are in the stock market, the better returns you get. This is because of the tailwind in the form of inflation and productivity gains.

However, be aware that we have tested just four strategies of the moving average. There are basically unlimited ways you can use a moving average and your imagination is probably the most restricting factor!

What is Kaufman’s adaptive moving average (KAMA)?

Developed by American quantitative financial theorist Perry J. Kaufman in 1998, the adaptive moving average (KAMA) is a moving average designed to account for market noise, aka volatility. The indicator closely follows prices when the price swings are relatively small and the noise is low but adjusts when the price swings widen and follow prices from a greater distance.

In essence, the adaptive moving average works like a slow-moving average, as it reduces the influence of outliers, without sacrificing the sensitivity. It is a trend-following indicator that can be used to identify the overall trend, time turning points, and filter price movements. Although the technique began in 1972, it was Kaufman who officially presented it to the public many years later through his book: “Trading Systems and Methods.”

Unlike other moving averages, the adaptive moving average accounts not only for price action but also for market volatility. In another book titled, “Smarter Trading”, Kaufman offers some interesting adaptations of the trend-following approaches. He believes that trend following should be a safe and conservative approach to the markets, so traders need to be able to separate the trend from the random noise of the market at any given time.

The adaptive moving average is based on the idea that a noisy market requires a longer trend than one with less noise. As you know, noise is the erratic up-and-down price movement that can be seen within a trend or during a sideways period.

According to Kaufman, while longer trends are the most dependable, they respond very slowly to changing market circumstances. Since slower moving averages barely reflect forceful, short-term price movements, by the time they generate their signals, the price move may have been completed. So, the solution should be an adaptive method for trend following — one that speeds up entry when the markets are moving and does nothing when the markets are going sideways. This is why Kaufman created an adaptive moving average that can adjust to market volatility.

How to calculate the Kaufman adaptive moving average

There are several steps involved in calculating the Kaufman adaptive moving average. Perry Kaufman recommended keeping the settings at 10, 2, and 30. That is, when calculating Kaufman’s Adaptive Moving Average, do the following:

  • Keep the number of periods for the efficiency ratio at 10
  • Set the number of periods for the fastest exponential moving average at 2
  • Set the number of periods for the slowest exponential moving average at 30

The first thing to calculate when creating KAMA is the value of the efficiency ratio and the smoothing constant. Let’s take a look at them.

Step 1: Calculating the efficiency ratio (ER)

To define the current market state, Kaufman introduced the notion of Efficiency Ratio to show the efficiency of price changes. The ER fluctuates between 1 and 0. When the price remains unchanged over 10 periods, the ER is zero, but if the price moves up or down 10 consecutive periods, the ER moves to 1. The ER is calculated by dividing the absolute difference between the current price and the price at the beginning of the period by the sum of the absolute difference between each pair of closes during the period. The formula for calculating ER is given thus:


ER = Change/volatility


Change = Absolute Value [Close – Close (past 10 periods)]

Volatility Sum = 10 periods (Close – Prior Close)

Step 2: Calculating the smoothing constant (SC)

The next step is to calculate the smoothing constant. This is done for each period, and it uses the value obtained for the efficiency ratio and two smoothing constants. The formula is given as follows:


SC= [ER x (Fastest SC – Slowest SC) + Slowest SC]2

Which translates to this:

SC= [ER x (2/ (2+1) – 2/(30+1)) +2/ (30+1)]2


From the above equation above, (2/30+1) is the smoothing constant for the recommended 30-period EMA. So, the slowest smoothing constant is the SC for the slowest 30-period EMA, and the fastest smoothing constant is the SC for shorter 2-period EMA.

Step 3: Calculating the Kaufman’s Adaptive Moving Average (KAMA)

When you have gotten the values of the efficiency function and smoothing constant, the next thing is to calculate the values of Kaufman’s Adaptive Moving Average indicator. The formula is as follows:


KAMAi = KAMAi-1 + SC x (Price – KAMA i-1)


KAMAi = the value of the current period

KAMAi-1 = the value of KAMA for the period preceding the period being calculated.

Price = the price data for the period being calculated.

While it is important to know how the indicator is derived, you don’t need to do the calculation yourself. Some trading platforms have the indicator, so the computer does the calculation.

How does the adaptive moving average work?

The adaptive moving average is designed to show the trend while putting the existing market condition into consideration. It aims to show the fastest trend possible using the shortest calculation interval for the existing market conditions, and its changes the speed of the trend by using an exponential smoothing while varying the smoothing constant each period.

The key assumption is that during a volatile period, the trend line has to lag further behind to avoid being violated by the erratic price movements, which would prematurely signal the end of a trend or the beginning of a new one. But during a period of less volatility, the trend line can be moved closer to the underlying price direction. To successfully identify the beginning of a trend the moving average should be as short as possible.

In essence, the adaptive moving average works like a slow-moving average in that it reduces the influence of outliers, without sacrificing the sensitivity. It has to be as long as necessary to avoid whipsaw losses and as short as possible to follow the price closely during periods of low volatility.

Let’s look at it this way: there are situations you want the moving average to be fast and at other times, you want it slow. But frequently adjusting your indicator yourself can be exhausting or even make things messed up. It becomes necessary to have a system that automatically adjusts the moving average when volatility changes, to adapt it to the new market condition. This is what the adaptive moving average does.

An adaptive moving average automatically adjusts itself to suit the prevailing market condition. It uses a continuously variable exponential moving average smoothing constant that increases as the price trend slope approaches the 90 degrees angle and decreases as the price trend slope nears zero. In other words, it operates like the Bollinger bands, which expand or contract in line with the prevailing market condition. But while the Bollinger bands indicator uses standard deviation to assess volatility, the adaptive moving average uses the efficiency ratio and smoothening constant.

The smoothing constant is used because it allows for a full range of trends, represented as percentages, compared to the simple moving average, which is limited in its selection. The exponential moving average period length grows shorter and more responsive when the trend is steep and accelerating, but when the price trend flattens, the period length grows longer and less responsive.

Interpreting the adaptive moving average

The KAMA indicator helps traders to get a clear picture of the market’s behavior. It can easily be applied to a chart, and traders can customize it by specifying its parameters in the properties dialog box. The main customizable parameters are the calculation periods and the appearance of the indicator. You can specify the number of periods to apply in the indicator calculation. The default number of periods is 14, but you can select any value between 2 and 1000.

Although the indicator uses historical data to obtain the final values, you can use it to make a trading decision based on the theory that trends tend to continue in the same direction until something significant happens. Traders use the KAMA indicator to analyze the behavior of a market and predict future price movement.

The indicator can be used to identify existing trends, indications of a possible impending trend change, and market reversal points that can be used for trade entries or exits. So, you can use KAMA like any other trend-following indicator, like the simple moving average indicator. See the chart below:

Interpreting the adaptive moving average

When using the indicator, look for price crosses, directional changes, and filtered signals. A cross above or below the KAMA indicator could mean directional changes in prices. As with any moving average, the indicator can show a lot of false signals and lots of whipsaws, but you can reduce whipsaws by applying a price or time filter to the crossovers. Some traders want to see the price to hold the cross for a set number of days or wait for the indicator cross to exceed KAMA by a set percentage.

adaptive moving average

The advantage of Kaufman’s adaptive moving average

Normally, one of the disadvantages of the usual moving average indicators is that accidental price leaps can result in the appearance of false trend signals, and on the other hand, excessive price smoothing can lead to the unavoidable lag of a signal about trend stop or change. The KAMA indicator was developed to address these two disadvantages.

When market volatility is low, the KAMA indicator remains near the current market price, but when volatility increases, it will lag to avoid being violated by exaggerated price swings. That is, the KAMA indicator tries to filter out “market noise” while maintaining its representation of the real trend. So, the KAMA indicator seeks to lessen the frequency of false signals by not responding to short-term, insignificant price movements, which makes it better than the traditional moving average methods.

How to use the adaptive moving average

As we have stated earlier, one of the uses of the KAMA indicator is to identify the general trend of current market price action — when the KAMA indicator line is moving downward, especially with the price lying mostly below it, it indicates the existence of a downtrend. On the other hand, when the KAMA line is moving upward, it shows a potential uptrend. When compared to the simple moving average indicator, the KAMA indicator is less likely to generate false signals that may cause a trader to incur losses.

With that said, here’s how you can use the KAMA indicator in your trading:

  • Combine it with price action analysis: Use the KAMA to identify the direction of the market, and then use reversal candlestick patterns at support or resistance levels to indicate trade entry.
  • Use two KAMA indicators: you can use them to spot the beginning of new trends and pinpoint trend reversal points: You can do this by plotting two KAMA lines on a chart — one with a more short-term moving average (faster) and another with a longer-term moving average (slower). The faster KAMA line crossing above the slower KAMA line implies a change from a downtrend to an uptrend. When this happens, you can take a long position and close the trade when the faster MA line crosses back below the slower MA line.
  • Use the price crossing the indicator to generate signals: When the price crosses from below to above the KAMA line, you have a bullish (buy) signal. On the other hand, when the price falls from above the KAMA line to below it, you may have a bearish (sell) signal.

However, no matter what you do, you must always backtest your trading ideas. What looks good by using anecdotal evidence might not be so good when you test on longer time frames.

Relevant articles about moving averages strategies and backtests

Moving averages have been around in the trading markets for a long time. Most likely, moving average strategies were the start of the systematic and automated trading strategies developed in the 1970s, for example by Ed Seykota. We believe it’s safe to assume moving averages were a much better trading indicator 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 develop profitable trading strategies based on moving averages but mainly based on short-term mean-reversion and longer trend-following. Furthermore, there exist many different moving averages and you can use a moving average differently/creatively, or you can combine moving averages with other parameters.

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

We have also published relevant trading moving average strategies:

Adaptive (Kaufman) moving average – takeaways

Our takeaway from the backtests is that adaptive moving average strategies work well if you buy on weakness (a close below the moving average) and sell on strength (a close above the moving average) when you use a short number of days. Opposite, it’s best to buy on strength (a close above the moving average) when you use a longer moving average.

Similar Posts