Moving Average Trading Strategy

Zero Lag Exponential Moving Average Trading Strategy: Backtest (ZLEMA)

Zero-lag exponential moving average strategy backtest (ZLEMA)

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 (ZLEMA) 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.

ZLEMA Faster Moving Average for Traders

Zero-lag exponential moving average strategy backtest and best settings

Before we go on to explain what a zero-lag exponential moving average (ZLEMA) 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 zero-lag exponential moving average strategy work? Can you make money by using zero-lag exponential 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.32

8.55

8.06

6.48

6.89

5.83

MDD

-41.43

-20.9

-34.2

-41.35

-40.86

-41.77

Strategy 2

Period

5

10

25

50

100

200

CAR

2.33

1.1

1.49

2.99

2.52

3.44

MDD

-53.13

-67.09

-66.09

-47.17

-53.34

-48

The first strategy shows that the zero-lag exponential moving average strategy of buying on weakness works really for most of the time frames (table 1). We define “weakness” as buying when prices are falling, ie. when the price breaks below the moving average. Table one has good to decent returns for all time frames, but ten days is the best.

As you can see, this works much better than buying on strength in table 2 (which is buying on a break above the moving average). We know from before that the stock market works well for mean-reversion strategies.

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

Strategy 3

Period

5

10

25

50

100

200

5

0.21

0.48

1.14

2.21

4.1

8.49

10

0.14

0.49

1.13

1.95

4.22

7.97

25

0.18

0.37

0.88

2.29

4.6

8.81

50

0.2

0.48

1.17

2.38

4.17

9.16

100

0.15

-0.04

0.54

2.01

3.57

8.44

200

0.17

0.51

0.52

1.78

4.87

8.76

Strategy 4

Period

5

10

25

50

100

200

5

0.17

0.45

1.06

1.98

4.21

8.63

10

0.27

0.31

0.91

2.19

4.51

8.56

25

0.12

0.3

0.79

2.09

3.93

9.01

50

0.08

0.36

1.03

1.97

3.69

8.85

100

0.09

0.07

0.31

1.4

2.73

7.69

200

0.21

0.38

0.92

1.21

4.47

7.26

The tables are not that different, except that table 1 has slightly better results up until 50 days. But after 50 days you get more or less equal results and results gravitate toward the average long-term results by owning stocks. The longer you are invested 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 the zero-lag exponential moving average (ZLEMA)?

The zero-lag exponential moving average (ZLEMA) is a type of exponential moving average that adds a momentum factor to reduce lag in the average so that it can track current prices more closely. It achieves this by positively weighting recent prices while adding negative weights on old prices.

The indicator was developed by John Ehlers and Rick Way.  Its main concept is to remove the lagging factor that is seen with most moving averages and trend-following indicators. It tends to follow prices closer, provide better averaging, and react well to price volatility.

It is calculated almost the same way as the exponential moving average, but in its case, it works on de-lagged data, unlike the exponential moving average that works on regular data. The data is de-lagged by subtracting the data from the ‘lag’ experienced on n-period ago thereby eliminating the cumulative effect of the moving average. This is done by introducing a momentum factor in such a way that recent data are weighted positively while old data are weighted negatively.

Just like a traditional moving average, the zero-lag exponential moving average can be used to track trends, identify support and resistance, clean out volatility and give a clear view of what is happening in the market. It has more edge compared to other moving averages because it does not place emphasis or weight on past prices, which is the reason for its so-called zero-lag attribute.

How to calculate a zero-lag exponential moving average

The formula for calculating the zero-lag exponential moving average (ZLEMA) for a given N- period is as follows:

Lag = [Period – 1] / 2

EMAdata = Data + [ Data – Data (lag days ago)]

Zero-lag exponential moving average = EMA[EMAdata, Period]

The idea is to calculate an exponential moving average (EMA) on de-lagged data instead of on regular data. From the formula above, the data is de-lagged by subtracting the data from lag days ago, which eliminates the cumulative effect of the moving average from price.

Why use a zero-lag exponential moving average (ZLEMA)?

The zero-lag exponential moving average can determine the direction of the trend with less lag. And because it removes the lag from the chart, it tends to react faster to price action than most other moving average indicators. This is particularly useful in situations where a trader wishes to identify individual price swings for short-term trading.

Since the zero-lag exponential moving average reacts to price action faster than an exponential moving average by eliminating the lag from its calculation, it may be most useful for short-term trading, such as day trading or swing trading. The indicator can be used the same way as other moving averages, but it tends to follow short-term market swings more closely. When the ZLEMA slopes up, a rally should be expected. When it slopes down, a dip should be expected.

The zero-lag exponential moving average can also show dynamic support and resistance levels on the chart. For example, in an uptrend, when the price declines to touch the moving average and it rallies back up; it may be a sign that the trend is continuing. The opposite is true in a downtrend.

How to use a zero-lag exponential moving average

Popular trading platforms have a built-in ZLEMA. To add it to your chart, simply visit your indicator tab and search for it. The settings can be left to default settings, but you can adjust them as you want. If you cannot find it on your trading platform, you can check many of the resources online for a script.

Your trading approach would determine how long you set the period: if you are more of a day trader and scalper, then a lower period should be considered for more trade signals. A trend follower would normally use a longer period.

How can you use a zero-lag exponential moving average?

The zero-lag exponential moving average can be used in the same way as other moving averages. You could trade using the moving average crossover or use it as a support and resistance line.

When using the crossover strategy with the ZLEMA, a buy signal is given when the short-period ZLEMA is above the long-period ZLEMA or any other moving average indicator. The signal is more potent if the price is above both averages. Your stop loss should be below the long-period average line.

A sell signal is given when the price goes below both moving averages and the short-period average is below the long-period average. Your stop loss should be placed above the long-period average.

Drawbacks with a zero-lag exponential moving average

Even though it is called the zero-lag exponential moving average, it still possesses some lag because it relies on past price data for its calculation. However, the lag is not as much as can be seen in an EMA of the same period.

While the indicator’s greatest strength is in its greatly reduced lag, which allows it to move closely with the price, this can become a problem in some market conditions. For example, when the market enters a period of consolidation, the indicator is more prone to getting whipsawed.

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 detailed descriptions and backtests. This is our list:

We have also published relevant trading moving average strategies:

FAQ Zero-lag exponential moving average

Let’s end the article with a few frequently asked questions:

What is a Zero-Lag Exponential Moving Average?

A Zero-Lag Exponential Moving Average (abbreviated ZLEMA) is an “advanced” technical analysis indicator that combines an exponential moving average (EMA) with a double-smoothing process, removing the “lag” typically seen in EMAs. This results in an indicator that is presumably more responsive to price changes, allowing traders to better anticipate market movements.

Does the zero-lag exponential moving average work?

Please look at the backtests in this post. Please also keep in mind that we have only backtested S&P 500. It might work better on other assets!

How does a Zero-Lag Exponential Moving Average work?

The ZLEMA indicator begins with an EMA, which is calculated using a weighting multiplier applied to the most recent price data.

The double-smoothing process used by the ZLEMA then applies a second weighting multiplier to the EMA, reducing the amount of lag between the indicator and the price.

What are the advantages of using a Zero-Lag Exponential Moving Average?

The main advantage of using a ZLEMA is its reduced lag, which allows traders to better anticipate price movements. This makes the ZLEMA a useful tool for traders looking to get ahead of the market and capture more trading opportunities. However, you must always backtest yourself to find out if the theory actually holds. Most of the time it doesn’t.

What are the disadvantages of using a Zero-Lag Exponential Moving Average?

The main disadvantage of using the ZLEMA is that it can be prone to false signals – like all moving averages. This is because the double-smoothing process used by the indicator can cause it to overreact to smaller price fluctuations, resulting in inaccurate signals. All moving averages are prone to whipsaws.

How can traders use a Zero-Lag Exponential Moving Average?

Traders can use the ZLEMA in a variety of ways. For example, they can look for crossovers of the indicator with the underlying price to identify potential entry and exit points. They can also use the ZLEMA to identify potential trends, or for confirming a trend that has already been identified.

There are plenty of ways to use any moving average. One other option is to use it as a rubber band strategy.

Zero-lag exponential moving average – takeaways

Our takeaway from the backtests is that zero-lag exponential 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. However, the longer you hold, the more the results gravitate toward the long-term average returns of owning stocks.

FAQ:

How does a Zero-Lag Exponential Moving Average work?

A ZLEMA is an advanced technical analysis indicator designed to reduce lag in traditional exponential moving averages, providing a more responsive tool for tracking price changes. The ZLEMA combines an exponential moving average (EMA) with a double-smoothing process, aiming to eliminate lag between the indicator and price. This involves positive weighting of recent prices and negative weighting of older prices.

Does the Zero-Lag Exponential Moving Average work for trading strategies?

The primary advantage is the reduced lag, allowing traders to better anticipate price movements. According to backtests on the S&P 500, ZLEMA-based strategies, especially buying on weakness (closing below the moving average) and selling on strength (closing above the moving average), have shown positive results, especially with shorter time frames.

How can traders use a Zero-Lag Exponential Moving Average?

Besides ZLEMA, various moving averages exist, each with its characteristics. Some examples include exponential moving averages (EMA), Hull moving average, weighted moving average, and more.besides ZLEMA, various moving averages exist, each with its characteristics. Some examples include exponential moving averages (EMA), Hull moving average, weighted moving average, and more. Traders can use ZLEMA for various purposes, such as identifying potential entry and exit points through crossovers with the underlying price. It can also help in trend identification and confirmation.

Similar Posts