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

Notification

Icon
Error

Options
Go to last post Go to first unread
noumann  
#1 Posted : Monday, January 12, 2015 6:49:42 PM(UTC)
noumann

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 10/16/2009(UTC)
Posts: 34

Hello everyone,

i'm tryiing to convert in metastock language the modified FRAMA formula.The process is indicated here  http://etfhq.com/blog/2010/09/30/fractal-adaptive-moving-average-frama/

The original FRAMA formula is:

y:=Input("sample time periods",1,1000,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.01,0.01,If(xt>1,1,xt));
x2:=1-x1;
If(Cum(1)=y2,
(C * x1) + (Ref(C,-1) * x2),
(C * x1) + (PREV * x2))

My modified FRAMA formula is:

y:=Input("sample time periods",1,1000,63);
Len:=Input("Lentaped",1,1000,252);
Vel:=Input("Veloceped",1,1000,126);
a:=(Len-Vel)/2;
pd:=If(a=Int(a),a,Int(a)+1);
ped:=pd+Vel;
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);
b:=Log(2/(Len+1));
xt:=Exp(b*(x-1));
OrN:=(2-xt)/xt;
NewN:=((Len-Vel)*((OrN-1)/(Len-1)))+Vel;
Newxt:=2/(NewN+1);
x1:=If(Newxt<(2/(Len+1)),2/(Len+1),If(Newxt>1,1,Newxt));
x2:=1-x1;
If(Cum(1)=y2,
(C * x1) + (Ref(ExtFml( "Forum.Sum",C ,ped )/ped,-1) * x2),
(C * x1) + (PREV * x2))

I'm not sure my formula is correct.

Could you help me?

Thanks

mstt  
#2 Posted : Monday, January 12, 2015 7:14:45 PM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi noumann What are you trying to achieve with your modifications? Clearly the results are quite different, but what difference(s) did you intend to make with your modifications? Roy
noumann  
#3 Posted : Monday, January 12, 2015 7:35:20 PM(UTC)
noumann

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 10/16/2009(UTC)
Posts: 34

 

Roy,

"Ehlers rigidly set the FRAMA to shift between a Fast EMA of 1 period (lets call it FC) and a Slow EMA of 198 days (lets call it SC)".

"With the modified version i want to be able to specifically define the “FC” and “SC” of my choice".

(http://etfhq.com/blog/2010/09/30/fractal-adaptive-moving-average-frama/)

But i’m not sure if I’ve correctly written the formula.

 

mstt  
#4 Posted : Thursday, January 15, 2015 3:45:23 AM(UTC)
mstt

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 7/25/2005(UTC)
Posts: 1,042

Was thanked: 57 time(s) in 54 post(s)
Hi noumann I'm not sure if it's written correctly - you didn't say what changes you wanted and I don't have time to try and figure out differences and possible errors. What I did have time for was workingout how to get rid of the PREV function in the original formula. I also made a couple of minor changes, just nit picking really. Here's the result using a variable Periods parameter via a DLL-based EMA function that also handles fractional periods. The MSTT DLL can be purchased from me for a small sum, and probably also from Wabbit y:=Input("sample time periods",1,1000,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:=Min(1,Max(0.01,xt)); x2:=1-x1; Pds:=2*(1/x1)-1; ValueWhen(1,Cum(1)>y2,ExtFml("MSTT.EMA",C,Pds)); Hope this helps some. Roy
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.