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

[amibroker] Kaufmans KAMA, but not exponential but based on SMA- crying for help



PureBytes Links

Trading Reference Links

Well I am a little bit confused...

I wanted to conduct these calculations:

K1=((Close-LLV(L,8))/(HHV(H,8)-LLV(L,8)))*100; 

and smooth this K1 with Kaufman adaptive moving average
KAMA=KAMA(T-1)+ SMOTHINGFACTOR*(P(T)-KAMA(T-1))

WHERE
T=PRESENT VALUE,
T-1 - PREVIOUS VALUE,
P(T) CURENT PRICE

but I need this based on simple moving average

so it could looks like this belowe, when I need smooth K1 not P, and N
-SMA periods.
KAMA=KAMA(T-1)+(1/N)*(K1(T)-KAMA(T-1))

Of course then the first value of KAMA should be calculated just like SMA.

I tried this AFL code :

K1=((Close-LLV(L,8))/(HHV(H,8)-LLV(L,8)))*100;
sc=(1/3);
K2=ama(K1,sc);
Plot(K2,"K2",6,4);

D2=ama(K2,sc);
Plot(D2,"D2",4,5);

but I am afraid that AMA is designed only for exponential MA and there
is a mistake in my AFL code

I have seen older posts about KAMA with exponential, but there is AMA2
used, still I dont know why there is not AMA which seems to be more
suitable


Content-Description: "AVG certification"
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.432 / Virus Database: 268.17.26/670 - Release Date: 2/5/2007 2:04 PM