Fractal adaptive moving average strategy backtest
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?
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 adjusts its lookback period based on this fractal geometry. It follows price closely when there are significant moves while remaining flat if the price ranges.
Fractal adaptive moving average strategy backtest and best settings
Before we go on to explain what a fractal 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 a fractal adaptive moving average strategy work? Can you make money by using fractal 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
Period |
5 |
10 |
25 |
50 |
100 |
200 |
CAR |
7.29 |
7.13 |
8.66 |
6.05 |
5.79 |
5.1 |
MDD |
-28.41 |
-33.68 |
-26.93 |
-44.73 |
-34.07 |
-33.29 |
Strategy 2
Period |
5 |
10 |
25 |
50 |
100 |
200 |
CAR |
2.26 |
2.4 |
1.04 |
3.38 |
3.69 |
4.3 |
MDD |
-58.93 |
-64.02 |
-64.33 |
-46.49 |
-53.85 |
-44.83 |
The results from the backtests are pretty revealing: both in the short and long run, the stock market shows tendencies to mean-reversion. Strategy 1 is consistently better than strategy 2 (buying strength and selling weakness) no matter the length of the moving average when we use a crossover system.
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).
The results from backtests 3 and 4 looks like this (the results are not CAGR, but average gains per trade):
Strategy 3
Period |
5 |
10 |
25 |
50 |
100 |
200 |
5 |
0.25 |
0.46 |
1.07 |
2.06 |
4.02 |
8.48 |
10 |
0.2 |
0.43 |
1.18 |
1.93 |
4.14 |
8.94 |
25 |
0.22 |
0.51 |
1.15 |
2.13 |
4.36 |
8.94 |
50 |
0.19 |
0.55 |
0.73 |
2.43 |
4.02 |
8.82 |
100 |
0.14 |
0.44 |
0.57 |
1.96 |
4.41 |
9.44 |
200 |
0.29 |
0.58 |
1.29 |
1.93 |
4.35 |
8.28 |
Strategy 4
Period |
5 |
10 |
25 |
50 |
100 |
200 |
5 |
0.16 |
0.18 |
0.88 |
1.82 |
4.11 |
8.94 |
10 |
0.14 |
0.28 |
0.98 |
1.92 |
3.99 |
8.59 |
25 |
0.24 |
0.2 |
0.85 |
2.08 |
4.31 |
9.09 |
50 |
0.13 |
0.38 |
0.75 |
2.07 |
4.19 |
8.07 |
100 |
0.17 |
0.18 |
0.79 |
1.07 |
3.91 |
7.95 |
200 |
0.24 |
0.34 |
0.98 |
1.99 |
4.11 |
8.32 |
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. The results in the table do not differ very much for 100 and 200 days, and this means that the returns are more or less in line with the random long-term gains in stocks.
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 a fractal adaptive moving average (FRAMA)?
Developed by John Ehlers, the fractal adaptive moving average is an EMA-based moving average that takes advantage of the fact that market movements assume fractal configurations and, thus, dynamically adjusts its lookback period based on this fractal geometry. In other words, its smoothed period is calculated based on the recent fractal dimension in a price series, so it takes the importance of price changes into account. As a result, it follows price closely when price movements are significant but remains flat if the price ranges.
To understand the FRAMA, you need to understand the concept of fractal in price movements. Fractals help to identify reversal patterns in the market by breaking down the broader trend into predictable signals. Fractal patterns consist of five or more price bars that indicate where prices have stalled or failed to advance (up fractal) or decline (down fractal).
The basic guidelines for identifying fractals are given below:
- An up fractal occurs when a candle on any timeframe has, on both sides, at least two candles with lower highs. This is usually a bearish signal.
- A down fractal occurs when a candle on any timeframe has, on both sides, at least two candles with higher lows. This is usually a bullish signal.
The major advantage of the fractal adaptive moving average is its ability to react fast to strong trends and to significantly slow down when the market is entering a period of consolidation.
How to calculate a fractal adaptive moving average
The actual calculation is very elaborate and complicated. It is based on the algorithm of the EMA, where the smoothing factor is obtained by taking into account the fractal dimension of the price series under observation.
The formula for calculating the FRAMA is as follows:
FRAMA_{t} = A_{t} X Price_{t }+ (1 – A_{t}) X FRAMA_{(t-1)}
Where:
FRAMA_{t} = Current value of FRAMA
Price_{t} = Current Price
FRAMA_{(t-1)} = Previous Value of FRAMA
A_{t} = exponential smoothing factor.
The exponential smoothing factor is obtained by using the formula below:
A_{t} = EXP[-4.6 X (D_{t} – 1)]
Where:
D_{t} = Current fractal dimension;
EXP = Mathematical exponent function.
Why use a fractal adaptive moving average?
The fractal adaptive moving average, FRAMA, tracks price closely. But when there is increased volatility, the indicator will slow down. The indicator can pinpoint market turning points and help reduce noise from price movements.
The main advantage of the fractal adaptive moving average over the traditional moving average is that it tends to slow down when the market enters a range but quickly catch up when there is an explosive trend. This makes it rather useful to ride massive trends.
How to use a fractal adaptive moving average
The fractal adaptive moving average can be found on many trading platforms, such as Tradingview, MetaTrader, and ThinkorSwim. Simply click on your indicator tab and search for it using the name. The settings can be adjusted as you wish. You can also create your own FRAMA indicator by coding it using any of the numerous online resources.
If you want the FRAMA to react very quickly to price and show individual price swings, a short period like 5 or 10 is ideal. A long period like 50 or 100 tends to react slowly to price and is mostly used to view the long-term trend of the market.
How can you use a fractal adaptive moving average?
You can use the FRAMA to perform the same kinds of technical analysis you do with other moving averages. You can use it to identify the trend, note potential support and resistance levels, and even generate buy or sell signals. The direction of the FRAMA indicator can tell the broader trend of a market. If the indicator is rising and recording higher highs, the market is in an uptrend. But, when it is falling, then the market is in a downtrend.
A long-period FRAMA can serve as a dynamic support or resistance level, depending on the market condition. In an uptrend, a rising FRAMA can serve as an ascending support level. When the price pulls back to that level, you can look for bullish signs, such as a hammer candlestick pattern, to enter a long position. Likewise, in a downtrend, a falling FRAMA can serve as a descending resistance level. When the price rallies to the indicator line and reverses, you can enter a short position. A bearish reversal candlestick pattern, such as the shooting star can be your trade trigger.
Furthermore, by combining two FRAMA indicators, you can make use of the crossover strategy to generate signals. In this case, you will use a short-period FRAMA and a long-period FRAMA. The long-period FRAMA can be used to determine the general trend. Then you can trade in the market’s direction using the short-period FRAMA. However, you should note that the FRAMA, just like other moving averages, may subject you to false signals when using the crossover strategy. This can be minimized by using a time filter or price filter on the crossover signals.
Drawbacks with a fractal adaptive moving average
As with all moving averages, the fractal adaptive moving average is a lagging indicator, as it relies on past price data for its calculation. Thus, it cannot reliably forecast future price movements.
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:
- Moving average trading strategies
- 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)
- 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
FAQ fractal adaptive moving average
Let’s end the article with a few frequently asked questions:
What is Fractal Adaptive Moving Average (FRAMA) strategy?
The FRAMA strategy is a technical analysis tool developed by John Ehlers that is used to identify trending markets and to measure the strength of the trend. FRAMA is a type of moving average that adjusts itself in response to the volatility of the market. This allows it to be more adaptive to changing market conditions than traditional moving averages.
How does the FRAMA strategy work?
The FRAMA strategy works by measuring the rate of change in the price of a security over time. When the rate of change is high, it is considered to be in an uptrend. When the rate of change is low, it is considered to be in a downtrend. The FRAMA indicator uses an adaptive moving average to determine when these trends are occurring.
What are the benefits of using the FRAMA strategy?
The main benefits of using the FRAMA strategy are its ability to identify trends more accurately than traditional moving averages, its adaptability to changing market conditions, and its ability to measure the strength of a trend. It can also be used to confirm price movements and provide entry and exit points for trades.
What are the risks associated with using the FRAMA strategy?
The main risk associated with using the FRAMA strategy is that it may produce false signals. As with any technical indicator, it is important to use it in combination with other indicators to confirm price movements. It is also important to use good money management and risk management strategies.
What time frames is the FRAMA strategy best suited for?
The FRAMA strategy is best suited for short-term to intermediate-term time frames. This includes time frames such as 1-minute, 5-minute, 15-minute, 30-minute, 1-hour, 4-hour, and daily charts.
Does the fractal adaptive moving average work?
At the end of the day, what natters for most traders is to make money. Our backtests show that the fractal adaptive moving average workss decently on stocks.
Does it work on other assets? The only way to find out is to backtest!
Fractal adaptive moving average – takeaways
Our takeaway from the backtests is that fractal 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 any number of days in a crossover system.