R&D Blog
Zero Lag Moving Average Filter | Trading Strategy (Entry & Filter)
I. Trading Strategy
Developer: John Ehlers and Ric Way. Source: Ehlers, J., Way, R. (2010). Zero Lag (well, almost). Concept: Trend following trading strategy based on moving average filters. Research Goal: To verify performance of the Zero Lag Moving Average (ZLMA). Specification: Table 1. Results: Figure 1-2. Trade Filter: Long Trades: Zero Lag Moving Average (ZLMA) crosses over Exponential Moving Average (EMA). Short Trades: Zero Lag Moving Average (ZLMA) crosses under Exponential Moving Average (EMA). Portfolio: 42 futures markets from four major market sectors (commodities, currencies, interest rates, and equity indexes). Data: 36 years since 1980. Testing Platform: MATLAB®.
II. Sensitivity Test
All 3-D charts are followed by 2-D contour charts for Profit Factor, Sharpe Ratio, Ulcer Performance Index, CAGR, Maximum Drawdown, Percent Profitable Trades, and Avg. Win / Avg. Loss Ratio. The final picture shows sensitivity of Equity Curve.
Tested Variables: Gain_Limit, Threshold (Definitions: Table 1):
Figure 1 | Portfolio Performance (Inputs: Table 1; Commission & Slippage: $0).
STRATEGY | SPECIFICATION | PARAMETERS |
Auxiliary Variables: | Exponential Moving Average (EMA): Alpha = 2 / (Look_Back + 1); EMA[i] = Alpha × Close[i] + (1 − Alpha) × EMA[i − 1]; Index: i ~ Current Bar. Zero Lag Moving Average (ZLMA): Alpha = 2 / (Look_Back + 1); ZLMA[i] = Alpha × (EMA[i] + Gain × (Close[i] − ZLMA[i − 1])) + (1 − Alpha) × ZLMA[i − 1]; Index: i ~ Current Bar. Variable Gain (from the ZLMA formula): If the variable Gain is zero, the ZLMA becomes just an EMA. If the Gain is sufficiently large, the ZLMA tracks the price for all practical purposes (i.e. minimum lag and minimum smoothing). Therefore, we seek a value of Gain that is a satisfactory compromise. To get the least amount of error (Error = Close[i] − ZLMA[i]), a loop searches for the best value of Gain by varying the Gain variable from the lower Gain_Limit to the upper Gain_Limit. The default value for the variable Gain_Limit is 5. | Look_Back = 200; Gain_Limit = [1, 10], Step = 0.25; |
Setup: | N/A. | |
Filter: | Long Signal: ZLMA[i] crosses over EMA[i], and 100*Least_Error / ATR[i] > Threshold Index: i ~ Current Bar. Short Signal: ZLMA[i] crosses under EMA[i], and 100*Least_Error / ATR[i] > Threshold Index: i ~ Current Bar. Note: Error = Close[i] − ZLMA[i]. The Least_Error is an error for the best value of Gain found via a loop which runs bar-by-bar from the lower Gain_Limit to the upper Gain_Limit. In the original paper, the Least_Error is not normalized by the ATR (Average True Range) but by a closing price. This is not adequate for tests on continuous futures contracts and therefore the original formula was adjusted. Mode: The 2-phase reversal system (long/short). | Threshold = [0, 200], Step = 5; |
Entry: | Long Trades: A buy at the open is placed after a Long Signal. Short Trades: A sell at the open is placed after a Short Signal. | |
Exit: | Stop Loss Exit: ATR(ATR_Length) is the Average True Range over a period of ATR_Length. ATR_Stop is a multiple of ATR(ATR_Length). Long Trades: A sell stop is placed at [Entry − ATR(ATR_Length) * ATR_Stop]. Short Trades: A buy stop is placed at [Entry + ATR(ATR_Length) * ATR_Stop]. | ATR_Length = 20; ATR_Stop = 6; |
Sensitivity Test: | Gain_Limit = [1, 10], Step = 0.25 Threshold = [0, 200], Step = 5 | |
Position Sizing: | Initial_Capital = $1,000,000 Fixed_Fractional = 1% Portfolio = 42 US Futures ATR_Stop = 6 (ATR ~ Average True Range) ATR_Length = 20 | |
Data: | 42 futures markets; 36 years (1980/01/01−2016/06/30) |
Table 1 | Specification: Trading Strategy.
III. Sensitivity Test with Commission & Slippage
Tested Variables: Gain_Limit, Threshold (Definitions: Table 1):
Figure 2 | Portfolio Performance (Inputs: Table 1; Commission & Slippage: $100 Round Turn).
IV. Benchmarking
We benchmark the base case strategy against alternatives:
Case #1: Gain_Limit = 1; Threshold = 100.
Case #2: Gain_Limit = 3; Threshold = 100.
Case #3: Gain_Limit = 5; Threshold = 100 (Base Case).
Case #4: Gain_Limit = 7; Threshold = 100.
Fixed Fractional Sizing | Case #1 | Case #2 | Case #3 | Case #4 |
Net Profit ($) | 255,002,050 | 450,898,827 | 415,980,346 | 339,371,870 |
Sharpe Ratio | 0.86 | 0.93 | 0.90 | 0.86 |
Ulcer Performance Index (UPI) | 0.99 | 1.14 | 0.96 | 0.90 |
Profit Factor | 1.49 | 1.44 | 1.32 | 1.29 |
CAGR (%) | 16.58 | 18.43 | 18.16 | 17.50 |
Max. Drawdown (%) | (49.53) | (50.77) | (57.40) | (58.46) |
Percent Profitable Trades (%) | 33.43 | 32.60 | 30.67 | 30.37 |
Avg. Win / Avg. Loss Ratio | 2.97 | 2.97 | 2.99 | 2.96 |
Table 2 | Inputs: Table 1; Fixed Fractional Sizing: 1%; Commission & Slippage: $100 Round Turn.
V. Rating: Zero Lag Moving Average Filter | Trading Strategy
A/B/C/D
VI. Summary
The trading strategy based on the Zero Lag Moving Average does not perform significantly better than the strategy based on the Hull Moving Average or some other alternatives.
Related Entries: Zero Lag Moving Average Filter (Entry & Exit) | Simple Moving Average Filter (Entry & Exit) | Hull Moving Average Filter (Entry & Exit)
Related Topics: (Public) Trading Strategies
CFTC RULE 4.41: HYPOTHETICAL OR SIMULATED PERFORMANCE RESULTS HAVE CERTAIN LIMITATIONS. UNLIKE AN ACTUAL PERFORMANCE RECORD, SIMULATED RESULTS DO NOT REPRESENT ACTUAL TRADING. ALSO, SINCE THE TRADES HAVE NOT BEEN EXECUTED, THE RESULTS MAY HAVE UNDER-OR-OVER COMPENSATED FOR THE IMPACT, IF ANY, OF CERTAIN MARKET FACTORS, SUCH AS LACK OF LIQUIDITY. SIMULATED TRADING PROGRAMS IN GENERAL ARE ALSO SUBJECT TO THE FACT THAT THEY ARE DESIGNED WITH THE BENEFIT OF HINDSIGHT. NO REPRESENTATION IS BEING MADE THAT ANY ACCOUNT WILL OR IS LIKELY TO ACHIEVE PROFIT OR LOSSES SIMILAR TO THOSE SHOWN.
RISK DISCLOSURE: U.S. GOVERNMENT REQUIRED DISCLAIMER | CFTC RULE 4.41
Codes: matlab/ehlers/zeroLag