The Instantaneous Trendline
by John F. Ehlers, Ph.D.
Is it possible to have an instantaneous trendline?
To say that a trendline is "instantaneous" may be presumptuous, but because you can compute a continuous trendline with modern technology and thus assess the action in the markets, the term is somewhat appropriate.
A market can be in two modes - a trend mode and a cycle mode. That means you can describe the general market as a combination of the two. If you apply a simple moving average (SMA) over the period of a dominant cycle, the dominant cycle component can be completely eliminated.
Identifying a continuously varying dominant cycle and applying a simple average over the period of the dominant cycle on a bar-by-bar basis results in a variable-length moving average. That moving average is significant because it notches out the dominant cycle component. If the composite analytic waveform consists of a trend component and a cycle component, what remains after removing the cycle component is the trend. This is not precisely true, because there will always be components other than the dominant cycle present. But these secondary cycles usually have small amplitudes, providing a workable solution for trading purposes.
When you use an SMA with the length of the measured dominant cycle, the lag produced by the SMA is (dominant cycle - 1)/2. This suggests that if you have a 21-bar measured dominant cycle, the instantaneous trendline would be lagging the price by 10 bars. This is one of the limiting factors of such a technique, because it would be more advantageous to be as close to zero lag as possible.
This lag can be minimized, however, by using a smoothing filter specifically designed for minimum lag and then using a frequency notch filter to remove undesired frequency components. This strategy not only removes the dominant cycle, but also smooths the price waveform to form a superior instantaneous trendline.
The elliptic lowpass filters are known to produce the minimum amount of lag for a given reduction in strength, or attenuation. I selected a three-pole elliptic filter with a 0.8 decibel (dB) in-band ripple and a 30 dB bandstop attenuation to filter out the high-frequency components. By setting the 0.8 dB passband at a normalized frequency of 0.22 (a nine-bar cycle period), the filter has a notch exactly at a five-bar cycle and 30 dB or more attenuation for cycle periods shorter than five bars. The frequency response of this filter can be seen in Figure 1. The equation for this filter in EasyLanguage code is:Filt1 = 0.0542*Price + 0.021*Price + 0.021*Price + 0.0542*Price + 1.9733*Filt1 - 1.6067*Filt1 + 0.4831*Filt1
Figure 1: amplitude response of a three-bar elliptic filter. The filter has a notch at a five-bar cycle and 30 dB or more reduction for cycle periods shorter than five bars.
...Continued in the February 2002 issue of Technical Analysis of STOCKS & COMMODITIES
Excerpted from an article originally published in the February 2002 issue of Technical Analysis of STOCKS & COMMODITIES magazine. All rights reserved. © Copyright 2002, Technical Analysis, Inc.
Return to February 2002 Contents