0% found this document useful (0 votes)
245 views7 pages

The Joy of Detrending Iii

1) The document describes a new approach to detrending price data using techniques borrowed from radar signal analysis. 2) Specifically, it uses a "triple delay line canceller" method similar to radar's "Moving Target Indicator" circuits, which cancels out fixed targets between pulses to isolate moving targets. 3) When applied to price data, this technique removes trends and longer cycles from the data in a way that passes shorter cycles with high fidelity, retaining the cyclic characteristics of the original data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
245 views7 pages

The Joy of Detrending Iii

1) The document describes a new approach to detrending price data using techniques borrowed from radar signal analysis. 2) Specifically, it uses a "triple delay line canceller" method similar to radar's "Moving Target Indicator" circuits, which cancels out fixed targets between pulses to isolate moving targets. 3) When applied to price data, this technique removes trends and longer cycles from the data in a way that passes shorter cycles with high fidelity, retaining the cyclic characteristics of the original data.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 7

THE JOY OF DETRENDING III

By
John Ehlers
There must be a jillion ways to detrend price data. Given that, I had better have an
approach with significant advantages to write still another article on the subject. I
believe I have such an approach and will show you its distinct advantages. ne of the
advantages is that a detrended signal, combined with an optimum smoothing filter can
produce an awesome oscillator type indicator.
!y technical analysis techni"ues all use the methods of modern signal analysis. This
new detrending approach is borrowed from radar circuit designs. # radar wor$s by
transmitting a high power %& pulse of energy and listening for the return echoes from
various targets. %& energy travels at the speed of light, and so the round trip time for
an echo is '(.) microseconds per mile. The distance of the target from the transmitter
is a determined simply by measuring the time it ta$es for the echo to return. #fter
sufficient time has elapsed so that no more echoes are e*pected, the radar transmits
another pulse. The process is repetitive, and the time between repetitive transmitter
pulses is called the +%I ,+ulse %epetition Interval-.
Targets that are a fi*ed distance from the radar transmitter, such as buildings and
towers, always appear at the same range. !any radars, such as those used in air
traffic control, only care about moving targets. The fi*ed.distance targets are just clutter
and obscure the real targets of interest. Therefore, these radars use a circuit called !TI
,!oving Target Indicator-. There are several ways to implement !TI, but the simplest is
to use the echo from a fi*ed target due to the previous pulse to cancel the echo from
that same target from the current pulse. &igure ' is a bloc$ diagram showing how this
cancellation is accomplished.

&igure '. !TI +ulse /anceller Eliminates &i*ed Targets
The delay line delays the echo from the previous pulse by e*actly one +%I. Therefore
pulses from fi*ed targets appear at the summation device at e*actly the same time, and
are therefore cancelled. +ulses from moving targets do not occur at e*actly the same
time from pulse to pulse, and are therefore not cancelled.
0o how does this relate to detrending1 0imple. If we subtract the price 234 bars ago
from the current price, the common terms in the price are cancelled. Therefore, this 234
bar momentum function removes the static, or average, price component. Just as trends
#ll +ulse Echos
+%I 5elay
6
.
!oving Targets nly

correspond to slowly moving targets on the radar scope, they tend to be removed by the
234 day momentum function. /omple* price movements can be analy7ed as being
synthesi7ed from a number of cyclic components, so the "uestion really is how all these
cycle components are affected by the momentum function.
/onsider a 8 bar momentum function, where the price 8 bars ago is subtracted from the
current price. /ertainly the constant value common to both prices is removed. The
longer cycle components ,the trends- also tend to be removed. 0horter and shorter
cycle components tend to be passed, at least until the cycle periods shorten to be
appro*imately 8 bars. # 8 bar cycle component will be completely removed by the 8 bar
momentum due to complete cancellation. 9armonics of 8 bar cycles ,: bar cycles, '.;
bar cycles, etc.- will also be completely cancelled. Therefore, a 8 bar momentum
function is not useful for waveforms having cycle periods shorter than about '< bars. In
trading daily data this is probably acceptable because we are typically not interested in
cycles shorter than two wee$s. The subgraph of &igure ( shows how a 8 bar
momentum function removes the constant term and gets better and better at passing
the shorter cycle periods. That is, the amplitude across the spectrum is not uniform.
&igure (. # 8 Bar !omentum +asses 0horter /ycles !ore Efficiently
=hy not use a shorter momentum function, such as a ) Bar momentum, to pass more
of the shorter cycle components1 The answer, as demonstrated in &igure :, is that the
longer cycle periods are passed less efficiently. The amplitude of the longer cycles
undergoes greater attenuation in this case.
&igure :. # ) Bar !omentum Is >ess Efficient at +assing >onger /ycles
%adars solve the problem of passing a wide range of different velocities through the !TI
circuits by using more comple* filters. ne such circuit, shown in &igure ), is
constructed as a triple delay.line canceller.
&igure ). Triple 5elay >ine !TI /anceller Bloc$ 5iagram
5E>#? 5E>#? 5E>#?
.'
.<@@
'.(
(
..A
E
in
E
out
The Easy>anguage /ode to implement the Triple 5elay >ine /anceller as a detrender
isB
Inputs: Price((H+L)/2);
Vars: Detrend(0);
Value1 = Price + .088Value1!"#;
Value2 = Value1 $ Value1!"# + 1.2Value2!"# % .&Value2!12#;
Detrend = Value2!12# $ 2Value2!"# + Value2;
Pl't1(Detrend( )Detrend*);
The advantage of the Triple 5elay >ine filter for detrending is apparent through
e*amination of &igure ;. The detrended amplitude of all cycle components is almost the
same. Therefore, the detrended waveforms retain the cyclic characteristics of the
original waveforms with higher fidelity.
&igure ;. The Triple 5elay /anceller +asses #ll /ycle /omponents of Interest
In a different vein, I have been curious about how to design an optimum smoothing filter.
I set one criterion to be that the smoother could have no more than a one bar lag. #n
elliptic filter provides the ma*imum amount of smoothing under the constraint of a given
lag. 0o, using !#T>#B, I designed an elliptic filter whose performance characteristics
are described in &igure 8. I set the out.of.band attenuation to be C(< dB and adjusted
the in.band ripple to position the notch in the response to be e*actly at .; cycles per day
,a ( bar period-. The phase delay for a fre"uency .'(; cycles per day ,an @ bar cycle-
is appro*imately ;< degrees. ); degrees is one.eighth of a :8< degree full cycle, so
the delay computes to be one.eighth of an @ bar period. This shows the ' delay will be
slightly longer than the desired one bar delay.
&igure 8. %esponse /haracteristics of an Elliptic &ilter having a ne Bar >ag
The Easy>anguage code fragment to compute the optimum Elliptic &ilter isB
0mooth D .':A@;E+rice 6 .<<<AE+riceF'G 6 .':A@;E+riceF(G 6 '.('<:E0moothF'G . .)@8AE0moothF(G
Ta$ing a page out of the Halman &iltering boo$, I $now that I can reduce the effects of
lag by introducing an estimate of the velocity vector at each position. In this case, I
simply add the one day momentum of the price to the price value for that bar. 5oing
this, the modified optimum Elliptic &ilter becomesB
0mooth D .':A@;E,(E+rice C +riceF'G- 6 .<<<AE,(E+riceF'G C +riceF(G- 6 .':A@;E,(E+riceF(G C+riceF:G- 6
'.('<:E0moothF'G . .)@8AE0moothF(G
The ptimum 5etrender and the ptimum 0moothing &ilter can be used independently
in a variety of applications. In addition, when they are used together, an awesome
oscillator results. ?ou $now the detrender provides the ma*imum fidelity in the
detrended waveform with regard to both phase and amplitude. The ptimum 0moother
provides a minimum delay so that the crossing of the indicator lines is ma*imally
responsive to the changing price directions. # typical e*ample of this #wesome
scillator is shown in &igure A.
&igure A. The #wesome scillator catches every cyclic turn as it happens.
The appearance of the 5etrend line, in red, has been improved by smoothing with the
modified optimum Elliptic &ilter. The lag penalty is minimal. The smoothed 5etrended
signal is again smoothed with the modified optimum Elliptic filter, and is shown in cyan.
The crossings of the two indicator lines accurately catches every major cyclic move. #s
with all oscillators, with the e*ception of the 0inewave Indicator
'
, care must be ta$en in
using the signals when the mar$et is in a trend mode.
'
John Ehlers, 2# Trend.&riendly scillator4, 0toc$s I /ommodities, !ay (<<<
&igure 8. 9igh &idelity 5etrending %esults &rom the Jse of the Triple 5elay /anceller

You might also like