MetaStock™ Zone Forum & FAQ Artykuły Linki Elliott Waves EasyLanguage™ Zone

 A B C D E F G H I J K L M N O P R S T U V W Y Z #

Moving Average - Fractal Adaptive (FAMA) by John Ehlers

John Ehlers' article in this issue, "Fractal Adaptive Moving Averages," introduces
an indicator of the same name. In his indicator formula, he restricts the number of periods to an even number. The formula in MetaStock avoids this restriction by asking for the smaller time frame. This number is then used for the two half-interval calculations and is then doubled for the full interval calculation. The formula for this indicator and the steps to include it in MetaStock are presented here. To enter this indicator into MetaStock:

1. In the Tools menu, select Indicator Builder.
2. Click New to open the Indicator Editor for a new indicator.
3. Type the name of the formula.
4. Click in the larger window and input the following formula:

Moving Average - Fractal Adaptive (FAMA)

y:=Input("sample time periods",1,20,8);
y2:=2*y;
n1:=(HHV(H,y)-LLV(L,y))/y;
n2:=Ref((HHV(H,y)-LLV(L,y))/y,-y);
n3:=(HHV(H,y2)-LLV(L,y2))/y2;
x:=(Log(n1+n2)-Log(n3))/Log(2);
xt:=Exp(-4.6*(x-1));
x1:=If(xt<0.1,0.1,If(xt>1,1,xt));
x2:=1-x1;
x3:=If(Cum(1)=y2,
(MP() * x1) + (Ref(MP(),-1) * x2),
(MP() * x1) + (PREV * x2));
x3;

--William Golson,
Equis International www.equis.com

Source / From: TOP