[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Cycle Length



PureBytes Links

Trading Reference Links

> I'm wondering, in the following expression:
>     LRS = LinearRegSlope(xaverage(Price,20)-xaverage(Price,15), 10);
> shouldn't the longert term average be subtracted from the shorter term
> average instead? Ie,
>     LRS = LinearRegSlope(xaverage(Price,15)-xaverage(Price,20), 10);

Good catch.  Typo on my part.

For anyone wondering what I'm doing here:

xaverage (or any average) is a lowpass filter.  It filters out 
the high-frequency component of the signal and passes the lower 
frequencies.  That's why the xaverage is smoother.  The noisy 
jittery parts of the signal are the high-frequency components.

C-xaverage is a highpass filter.  It subtracts xaverage's lowpass 
frequencies from the raw price signal, leaving the high freqs.  
That way you have all the noise, but you remove some of the trend 
component.  Not generally real useful, because noise just gets in 
the way of trading decisions.

xaverage - xaverage is a bandpass filter.  It filters out low 
frequencies (trend) AND high frequencies (noise) leaving you only 
the cyclic information.

I can never remember the exact xavg-len to frequency conversion 
process, but we don't need to know the exact freqs here anyway.  
Just notice that xaverage(Price,15) is a faster, noisier signal 
than xaverage(Price,20); that means the len=15 xavg has a higher 
cutoff frequency, allowing more high-freq noisy signal through.  
So we want it to define the top frequency of our bandpass, so it 
passes all frequencies below its cutoff.  That means it's a 
lowpass so it's the positive component of the bandpass 
calculation.  Conversely the len=20 xavg has a lower cutoff 
frequency, so we want it to define the bottom of our bandpass.  
It should pass frequencies above its cutoff, meaning it's a 
highpass filter, so we use it in the negative component of the 
bandpass calculation.

Clear as mud?  :-)

Even if you don't understand the derivation behind it, you can 
use this xaverage(Price,shortlen) - xaverage(Price,longlen) idea 
to grab the cycle component of a price waveform, filtering out 
the longer trend component and the shorter noise component.  
Experiment with different lengths and different spacing between 
the long/short lengths to see how it changes the results.  For 
example, using a larger value of longlen means your bottom cutoff 
frequency is lower, so more low-frequency (trend) signal gets 
through.  Using a smaller value of shortlen means your top cutoff 
frequency is higher, so more high-frequency (noise) signal gets 
through.  If you want less noise, increase shortlen.  If you want 
less trend, decrease longlen.  But keep longlen > shortlen or 
(like me) you'll invert your signal.

BTW I should have said the xavg-xavg signal was most similar to 
Chris's summation(C-C[1]) signal.  It still has some trend 
component, just like his signal did.  Running it through LRS just 
detrends it further.  And in fact LRS acts as a bandpass filter, 
removing both noise AND trend.  LRS actually does a better job of 
filtering out the trend component than the highpass xaverage.  
But I still think LRS(xavg-xavg) does the best job of extracting 
the pure cycle component.

Gary