Page 1 of 1

Kaufmann adaptive moving average

Posted: 06 Oct 2006
by redbank199
I am interested in plotting Kaufman adaptive moving average
on MultiCharts.

Does any one have the TS code for this moving average ?

Posted: 06 Oct 2006
by piranhaxp
Hi ....

I take this one .... :

KAMA-Indikator
-----------------

Code: Select all

inputs:
Price( Close ),
EffRatioLength( 20),
FastAvgLength( 3),
SlowAvgLength( 30 );

variables:
MAA( 0 ) ;

MAA = AdaptiveMovAvg( Price, EffRatioLength, FastAvgLength, SlowAvgLength ) ;

Plot1( MAA, "MAA" ) ;
AdaptiveMovAvg-Function
----------------------------

Code: Select all

inputs:
Price( numericseries ),
EffRatioLength( numericsimple ),
FastAvgLength( numericsimple ), { this input assumed to be a constant >= 1 }
SlowAvgLength( numericsimple ) ; { this input assumed to be a constant >= 1 }

variables:
NetChg( 0 ),
TotChg( 0 ),
EffRatio( 0 ),
ScaledSFSqr( 0 ),
SlowAvgSF( 2 / ( SlowAvgLength + 1 ) ),
FastAvgSF( 2 / ( FastAvgLength + 1 ) ),
SFDiff( FastAvgSF - SlowAvgSF ) ;



if CurrentBar = 1 then
AdaptiveMovAvg = Price
else
begin
NetChg = AbsValue( Price - Price[ EffRatioLength ] ) ;
TotChg = Summation( AbsValue( Price - Price[1] ), EffRatioLength ) ;
if TotChg > 0 then
EffRatio = NetChg / TotChg
else
EffRatio = 0 ;

ScaledSFSqr = Square( SlowAvgSF + EffRatio * SFDiff ) ;
AdaptiveMovAvg = AdaptiveMovAvg[1] + ScaledSFSqr * ( Price - AdaptiveMovAvg[1] ) ;
end ;
Hope this is what you want.

Mike

Posted: 07 Oct 2006
by redbank199
Mike,

Thanks.

Posted: 07 Oct 2006
by redbank199
Mike,

I just checked the code for Adaptive Moving Average in MultiChart's
PowerLanguage editor. Your code looks like the same as the code
there. So you think the AMA in MultiCharts is the Kaufman AMA ?
I do not have Kaufma's book yet, so I can not verify it. I think it
should be described in Kaufman's book.