Kaufmann adaptive moving average

Studies that have been contributed to the community by other users. If you’ve got something useful to share, that’s great!
redbank199
Posts: 3
Joined: 29 Sep 2006

Kaufmann adaptive moving average

Postby redbank199 » 06 Oct 2006

I am interested in plotting Kaufman adaptive moving average
on MultiCharts.

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

User avatar
piranhaxp
Posts: 236
Joined: 18 Oct 2005
Has thanked: 4 times
Been thanked: 29 times

Postby piranhaxp » 06 Oct 2006

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

redbank199
Posts: 3
Joined: 29 Sep 2006

Postby redbank199 » 07 Oct 2006

Mike,

Thanks.

redbank199
Posts: 3
Joined: 29 Sep 2006

Postby redbank199 » 07 Oct 2006

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.


Return to “User Contributed Studies and Indicator Library”