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

Re: Adaptive Moving Average Kauffman



PureBytes Links

Trading Reference Links

See
http://groups.yahoo.com/group/amibroker/message/12863
http://groups.yahoo.com/group/amibroker/message/12871
etc.
DT
--- In amibroker@xxxx, "Luca Meroni" <luca.meroni@xxxx> wrote:
> Hi at all.
> I'm new with AB, but i find it very very good.
> The AFL language is very nice, and I try to learn it.
> I have the Adaptive Moving Average Kauffman formula for metastock:
> 
> 
> Periods := Input("Time Periods",1,1000, 10);
> 
> Direction := CLOSE - Ref(Close,-periods);
> 
> Volatility := Sum(Abs(ROC(CLOSE,1,$)),periods);
> 
> ER := Abs(Direction/Volatility);
> 
> FastSC := 2/(2 + 1);
> 
> SlowSC := 2/(30 + 1);
> 
> SSC := ER * (FastSC - SlowSC) + SlowSC;
> 
> Constant := Pwr(SSC,2);
> 
> AMA := If(Cum(1) = periods +1, ref(Close,-1) + constant * (CLOSE - 
ref(Close,-1)),Prev + constant * (CLOSE - PREV));
> 
> AMA
> 
> How can I tranlate in AFL ?
> 
> 
> 
> Thanks, Luca