logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
klkoo  
#1 Posted : Tuesday, September 12, 2006 9:52:09 AM(UTC)
klkoo

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/21/2005(UTC)
Posts: 16

What is the metastock formula for the FAMA with 5 period ?

How do create a high band & low band for the FAMA(5) which act as a channel ?

wabbit  
#2 Posted : Tuesday, September 12, 2006 10:07:51 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
This code is a little old.... I've had it for a while and never used it so, use with caution

Code:

{Fractal Adaptive Moving Average (FAMA)}
 prd:=Input("Periods",1,20,5);

y2:=2*prd;

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;
FAMA:=If(Cum(1)=y2,(MP()*x1)+(Ref(MP(),-1)*x2),(MP()*x1)+(PREV*x2));
{plot}FAMA;
All you have to do now is add and subtract a width (constant value, percentage value, standard deviation, volatility, whatever) to form a channel e.g.

Code:
code as above ...{plot}
FAMA;FAMA + (2 * Stdev(C,prd));

FAMA - (2 * Stdev(C,prd));
Hope this helps. You could always use Google?

wabbit [:D]


NOTE: Code is untested and may contain errors, bugs, or dead hamsters!


P.S. If you want to get rid of the PREV, notice (MP()*x1)+(PREV*x2)) where x2:=1-x1 is just a EMA? Its late here and I a need sleep...
uasish  
#3 Posted : Wednesday, September 13, 2006 8:08:45 AM(UTC)
uasish

Rank: Advanced Member

Groups: Registered, Registered Users
Joined: 8/13/2005(UTC)
Posts: 170

Thanks: 7 times

Klkoo,

Sleepy Wabbit missed :// y:= prd; // We can put this in Line-2.Wabbit is Master in coding.

Asish

wabbit  
#4 Posted : Wednesday, September 13, 2006 8:51:37 AM(UTC)
wabbit

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers, Unverified Users
Joined: 10/28/2004(UTC)
Posts: 3,111
Location: Perth, Western Australia

Was thanked: 16 time(s) in 16 post(s)
It obvious where I started typing in the code by hand and went, wait! Why dont' I just copy and paste?

Yesterday was a looooong day!

Thanks Asish



Users browsing this topic
Guest (Hidden)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.