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

Re: Is there really another way



PureBytes Links

Trading Reference Links

Tim wrote:

> I found both of these posts very educational. I don't thoroughly
> understand the high band/low band pass portion, but I think I have
> a feeling about what you were trying to do. Makes me wonder why
> people aren't paying you two $5000 a pop for something. At least
> they'd be getting quality information.  

Umm, I think Bob deserves most of the credit so far!  I'm just trying
to ask some reasonably intelligent questions.  But $5000 sounds
pretty good!  Send your checks to me at......  :-)

Let me see if I can earn my share of the $5k consulting fees...

Bob wrote:
> Since you are an EE (as am I), I will use that terminology. 

Well, it might be stretching things to call me an EE.  I took some EE 
courses 20 years ago but ended up spending all my time playing 
with computers.  I barely remember the filter design terminology
you're using.  Maybe it will help everyone on the list if I try to
re-state what you're saying for the EE-challenged among us.
(Myself definitely included!!)

Bob, please correct any misunderstandings I have so I don't 
confuse the whole list!  

I'd actually never even thought of MA's as filters, but now that you've 
explained it that way it makes perfect sense.  

A complex waveform can be thought of as a combination of many
simple waveforms of different frequencies.  So, for example,
let's say the S&P is oscillating about once per day -- it hits a high
in the morning, low in midday, and a high again by the close.
The "high-to-high" length is the "period" of the oscillation.
Frequency is the inverse of the period, so the more bars in
the high-to-high period, the lower the frequency.

So the S&P is showing a low-frequency oscillation of about
one cycle per day.  But during the day it makes many smaller
wiggles.  These have shorter high-to-high periods, so they 
have a higher frequency.  Also, as a rule, any "steep" portions
(sudden changes) tend to have high frequency components.
The sharper the change, the higher the frequency, and
the easier it is to filter it out with a low-pass filter.  Similarly, 
long gradual changes (like long-term trends) have a low
frequency.

Add all those frequencies together and you get the entire 
complex S&P waveform.  Similarly, you can start with the
complex waveform and *SUBTRACT* frequencies to
remove high-frequency or low-frequency information.
That's what Bob means by a "filter."

An MA is a low-pass filter, in that it filters out the "high-frequency" 
components (fast wiggles) of the price signal.  (It "passes through" 
the lower frequencies, hence the term "low-pass.")  That's why an 
MA of a price series is "smoother" than the price series itself -- the 
high-frequency "fast wiggles" have been filtered out.  I guess you 
can also make a high-pass filter by subtracting the MA from the 
price; e.g.  

  Close - MA(Close, periods)

removes the low-frequency components and leaves just the wiggles.

> The numbers
> in the post are a good start (5 to 15 bars period). That would be 17 to 45
> cycles per year on daily data. 

The longer the #periods of the MA, the lower the "cutoff frequency"
of the filter.  I.e. longer-period MA's cut off longer- and longer-period
cycle information.  So what you're saying is that a 5-bar XMA would
cut off everything above 45 cycles per year, correct?  I.e. it filters
out everything with a period less than about 260/45 = 5.77 bars?
And a 15-bar XMA filters out everything with a period less than
260/17 = 15.3 bars.  Hmm, looks like you're saying that an
N-bar XMA cuts out everything with a period less than N bars.
I didn't realize it was that simple a relationship.

> You need to watch the phase shift since this
> causes delays.

A "phase shift" being a place where it changes the frequency at 
which it oscillates -- maybe moving from a trading range into
a trend or vice versa.  (Or were you talking about the phase shift
inherent in the filter, Bob?  See the section about "lag," below.)

Hm.  Bob, is there some reasonable way (short of MESA or
Fourier analysis) to determine the primary resonant frequency,
and detect the phase shift?  It would be very useful to be able
to tell when to shift your strategy from range-bound to trending.

> The high-pass filter will remove the trend (DC component) and the low-pass
> filter will remove the high-frequency noise (to the extent of the cut-off
> rate of the filters). 

I.e. in the example I used:
    Xaverage(High,5) -XAverage(High,15)
"Xaverage(High, 5)" is the low-pass filter, removing everything with a 
period less than 5 bars, and "-Xaverage(High,15)" is the high-pass
filter, removing everything with a period GREATER than 15.
You're left with only the 5-to-15-bar-period information, which is
presumably what you're interested in.  This is a smoothed version
(high frequencies removed) of the local price movement with the
long-term trend (low frequencies) removed.

"DC" is EE-speak for Direct Current, which has a frequency of zero.
Bob's referring to the very-low-frequency trend component as the
DC component that is removed by the "-Xaverage(High,15)".

> >E.g. as a first experiment I tried plotting
> >  Xaverage(High,5) -XAverage(High,15) on a daily SPX chart,
> >and it does a reasonably good job of isolating the tops -- and the
> >bottoms too, since the swing bottoms tend to have low highs.
> This is fine but the XAverage filter has a cutoff rate of only 20 db per
> decade which is pretty slow. T3 may be better. 

The "cutoff rate" is a measure of how sharply the filter transitions
from "allowing everything through" to "cutting everything off."
E.g. the Xaverage(High,5) low-pass filter might completely
cut off information with a 2-bar period, moderately block info
with a 4- or 6-bar period, and completely pass info with a 
10-bar period.  Another filter with a steeper cutoff, such as 
the T3 Bob mentions, might completely block 4-bar info 
and completely pass 6-bar info.

Sharp cutoffs tend to carry other costs, but T3 seems to be
a very good filter.  Jurik's AMA is also excellent.

(Before anyone else asks, I have a copy of the T3 indicator
that Bob posted to the list a while back.  I'd post it to the whole
list, but dozens of people already FTP'd a copy after the last
time I mentioned it.  You can FTP it from 
ftp://ftp.frii.com/pub/fritz/T3.ela .  Please be sure to do whatever
magic your FTPer requires to copy it in binary format.)

One thing to be aware of:  this filtering and smoothing is not
free.  One of the most noticeable costs is lag time.  Filtered
data tends to lag behind the price data -- i.e. peaks in the
smoothed waveform happen AFTER the peaks in the price.
Which can really kill your entries and exits...  But that's
the nature of the beast.  Filters inherently cause some
"phase shift" (delay in the waveform) and all you can do 
is use a good filter with as little lag as possible and be aware
of the impact of the lag.  I'm told T3 and Jurik's AMA both
have very little lag, considering how well they filter.

> Avoid using filters with
> lots of poles and zeros - they have weird phase behavior.

This refers to the esoteric math (complex numbers, division by
zero, stuff like that) used to describe filter behavior.  I don't 
even remember exactly what it means.  :-)

Bob, is there a reasonably straightforward way to tell if a filter
has bad phase behavior?  What exactly do you *mean* by
"weird phase behavior"?

OK, I've lectured long enough.  Hope that was helpful,  
Gary