[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

Alex,

I am curious about Peter Kaufman's AMA(Adaptive Moving Average) and your
power to wavelength graph. It seems to respond fairly quickly, but yet does
a reasonable job filtering out the noise. I use it several ways in my own
trading.

===============================
Inputs: period(10);

vars: noise(0), signal(0), diff(0), efratio(0),
	smooth(1), fastend(.666), slowend(.0645), AMA(0);

{ Calculate Efficiency Ratio}
diff = @AbsValue(close - close[1]);
if(currentbar <= period) then AMA = close;
if (currentbar > period) then Begin
	signal = @AbsValue(close - close[period]);
	noise = @Summation(diff, period);
	if noise <> 0 then efratio = signal/noise;
End;
if currentbar <= period then AMA = close;
smooth = @Power(efratio * ( fastend - slowend ) + slowend,2);
{ ADAPTIVE MOVING AVERAGE}
	AMA = AMA[1] + smooth * (close - AMA[1]);
===============================================

Thanks in advance Alex! You and Bob are great contributors and I always
respect your inputs.

Dennis Todd

-----Original Message-----
From: Alex Matulich [mailto:alex@xxxxxxxxxxxxxx] 
Sent: Sunday, June 13, 2004 6:00 PM
To: bobrabcd@xxxxxxx
Cc: omega-list@xxxxxxxxxx
Subject: Re: _SMA3: A steep roll-off lowpass filter

> Alex and Bob, would you guys provide a technical analysis and critique
> of  this XMA function using the filter concepts in your previous posts?
> How  does it compare to the functions you've posted?  Do you see anyway
> to make  it "better" in terms of lag and overshoot?  How would you
> improve it  according to your ways of thinking?
>
> Inputs: Price(NumericSeries),Leng(NumericSimple);
> Vars:   EMA(0),n(leng),K(2/(n+1)),x((n-1)/2);
>
> EMA = K*(2*Price - Price[x])+(1-K)*EMA[1];
>
> XAverage_ZeroLag = EMA;

OK, attached is the frequency response.  This lowpass filter suffers from
a low-frequency gain at wavelengths longer than n.  Also, its
high-frequency rejection is a lot less than a standard EMA (in fact, you
can see the maximum attenuation points, those dips in the response, follow
the EMA frequency response curve).  This lack of attenuation of high
frequencies would explain the noise that Bob Fulks observed.

I tried the same trick with this one that I tried with my _SMA3, namely
cascading two or more filters so that the nulls in the response of one
filter cancels out the lobes in another.  You can get a good fall-off in
the response, resulting in a smoother output.  However, this magnifies the
low frequency gain even further.

This is an interesting concept -- use the n/2 momentum as a slope and
smooth the projected value n/2 bars in the future.

I tried using an exponential regression slope instead, and got a much
steeper rolloff, only without any ripples -- and it still had a low
frequency gain.

-Alex