[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 02:01 PM 6/11/2004, Alex Matulich wrote:

>I've come up with a simple lowpass filter that has a significantly sharper
>and steeper roll-off than the T3 Average while maintaining the size of the
>main lobe in the frequency response.  The basic function is:

Interesting.

You can greatly speed up the computation by expanding the coefficients.

The Simple Movingh Average is a simple FIR (Finite Impulse Response) filter so that if you cascade them, the final filter is also a FIR filter. Thus you can calculate the coefficients of the final filter once at CurrentBar = 1 then use them on each following bar.

Here is a simple example for Average(P1, 3) cascaded with Average(P2, 2);

f0 = a*c0 + a*c1 + a*c2   (where a = .33333)
f1 = a*c1 + a*c2 + a*c3   (where a = .33333)
g0 = b*f0 + b*f1          (where b = .50000)
   = a*b*c0 + a*b*c1 + a*b*c2 + a*b*c1 + a*b*c2 + a*b*c3
   = a*b*c0 + 2*a*b*c1 + 2*a*b*c2 + a*b*c3

You get the idea.

This can be done a couple or three of loops.

Bob Fulks