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

Re: _SMA3: A steep roll-off lowpass filter



PureBytes Links

Trading Reference Links

At 04:07 PM 6/11/2004, Alex Matulich wrote:


>I was hoping you'd see it.  Ever since you posted the T3 average
>code here, it has intrigued me, yet its overshoot problem bothered
>me at the same time.  Last night while falling asleep I got this
>idea to make something better.  Using the nulls in one SMA to cancel
>out sidelobes in another SMA seems so simple that I'm sure someone
>must have thought of it before me, but I can't recall seeing an
>example of anyone doing it.

John Ehler has several similar (but different) filters in his new book, 
"Cybernetic Analysis for Stocks and Futures". Some are derived from 
Butterworth filters but leaving out the feedback terms to prevent any 
overshoot. He gives the EasyLangage code so it is easy to experiment with 
the filters. The book is full is interesting filters so I think you would 
find it worthwhile.

I have several of my own versions of the T3 filter that also have no 
overshoot.

>>You can greatly speed up the computation by expanding the coefficients.
>
>I know, but doing so for 3 cascading SMAs would have complicated the
>EL code to the point of incomprehensibility, for the purposes of my
>article.

Probably true.


>I think it's computationally even more efficient (and easier to
>figure out) to maintain each SMA as a running sum rather than an
>average, and then divide each sum by its respective length to get
>the average.  You only need a loop just once at the beginning to
>initialize each sum, and after that you simply drop off the old
>value and add the new value -- no looping required.  This will
>accumulate error eventually, however, so every thousand bars or so
>one should re-initialize the sums.
>
>The code would be something like this:

That method should also be pretty fast.

There are lots of interesting things that you can do with FIR 
filters and I was just studying them recently.

Bob Fulks