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

Notification

Icon
Error

Options
Go to last post Go to first unread
Taff  
#1 Posted : Tuesday, March 4, 2008 3:33:11 AM(UTC)
Taff

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/4/2008(UTC)
Posts: 4

Hi,

I'm a newb with Metastock v10 and after some code for the following.

DMI Cross system:

Buy - Cross of PDI(8) over DMI(8) and Price over MA 50 and buy when price is 5points over yesterdays high.

Buy stop - Price drops below yesterdays low -5 (trailing)

Sell - Cross of MDI(8) over PDI(8) and Price less than MA50 and sell when price is 5points below yesterdays low.

Sell stop - Price moves above yesterdays high by 5 points (trailing)

Would like to use this for expert advisor and system tester..

Many thanks!!!

Taff

Taff  
#2 Posted : Tuesday, March 4, 2008 1:45:06 PM(UTC)
Taff

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/4/2008(UTC)
Posts: 4

Ok i think have the buy order set ok bar a wee issue with points above.

Buy order - Cross(PDI(8),MDI(8)) AND CLOSE >(Mov(CLOSE,40,SIMPLE)) AND H> Ref(H,-1)

Only thing is how do i set the buy price as 5points above prev high???

Buy exit - PRICE < Ref(L,-1)

Also on the buy exit it seems to put this exit in on every day even though the stock doesnt go below the prev low for sometime.

Any help much appreciated...

Thanks,

Taff

Justin  
#3 Posted : Friday, March 7, 2008 12:00:22 AM(UTC)
Justin

Rank: Advanced Member

Groups: Registered, Registered Users, Unverified Users
Joined: 9/13/2004(UTC)
Posts: 673
Location: Salt Lake City, UT

Are you wanting this specifically for the Expert Advisor, or the System Tester?
Taff  
#4 Posted : Saturday, March 8, 2008 6:25:26 PM(UTC)
Taff

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/4/2008(UTC)
Posts: 4

Both if possible!!!!
henry1224  
#5 Posted : Sunday, March 9, 2008 8:11:20 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)
Have you done a searech in the forum for DMI ?
henry1224  
#6 Posted : Sunday, March 9, 2008 8:23:40 AM(UTC)
henry1224

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 10/29/2004(UTC)
Posts: 1,394
Location: Glastonbury, CT

Was thanked: 2 time(s) in 2 post(s)

here is an example of an expert

You will need the PowerPivot Plus Add-on for this expert to work

Pring DMI w trend direction


Highlights

Long

{DMI SYSTEM }
A:= PDI(14);
B:= MDI(14);
TD:=ExtFml("PowerPivots.TrendDirection",1,2);
LE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A) and TD=1;
SE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A) and TD=-1;
LX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A);
SX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A);
B:=ExtFml("PowerPivots.SysEval",LE,LX,SE,SX,"!@#$#@!");
B>0

Short

{DMI SYSTEM }
A:= PDI(14);
B:= MDI(14);
TD:=ExtFml("PowerPivots.TrendDirection",1,2);
LE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A) and TD=1;
SE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A) and TD=-1;
LX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A);
SX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A);
B:=ExtFml("PowerPivots.SysEval",LE,LX,SE,SX,"!@#$#@!");
B<0

Out

{DMI SYSTEM }
A:= PDI(14);
B:= MDI(14);
TD:=ExtFml("PowerPivots.TrendDirection",1,2);
LE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A) and TD=1;
SE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A) and TD=-1;
LX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A);
SX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A);
B:=ExtFml("PowerPivots.SysEval",LE,LX,SE,SX,"!@#$#@!");
B=0


Symbols

Long entry

{DMI SYSTEM }
A:= PDI(14);
B:= MDI(14);
TD:=ExtFml("PowerPivots.TrendDirection",1,2);
LE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A) and TD=1;
SE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A) and TD=-1;
LX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A);
SX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A);
B:=ExtFml("PowerPivots.SysEval",LE,LX,SE,SX,"!@#$#@!");
B>0 AND Ref(B,-1)<=0


Short entry

{DMI SYSTEM }
A:= PDI(14);
B:= MDI(14);
TD:=ExtFml("PowerPivots.TrendDirection",1,2);
LE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A) and TD=1;
SE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A) and TD=-1;
LX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A);
SX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A);
B:=ExtFml("PowerPivots.SysEval",LE,LX,SE,SX,"!@#$#@!");
B<0 AND Ref(B,-1)>=0

Long exit

{DMI SYSTEM }
A:= PDI(14);
B:= MDI(14);
TD:=ExtFml("PowerPivots.TrendDirection",1,2);
LE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A) and TD=1;
SE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A) and TD=-1;
LX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A);
SX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A);
B:=ExtFml("PowerPivots.SysEval",LE,LX,SE,SX,"!@#$#@!");
B=0 AND Ref(B,-1)>0

Short exit

{DMI SYSTEM }
A:= PDI(14);
B:= MDI(14);
TD:=ExtFml("PowerPivots.TrendDirection",1,2);
LE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A) and TD=1;
SE:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A) and TD=-1;
LX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B>A);
SX:= (ADX(14)<25 ) AND (ADX(14)>Mov(ADX(14),10,S)) AND (Ref(ADX(14),-1)<Ref(Mov(ADX(14),10,S),-1)) AND (B<A);
B:=ExtFml("PowerPivots.SysEval",LE,LX,SE,SX,"!@#$#@!");
B=0 AND Ref(B,-1)<0

Taff  
#7 Posted : Sunday, March 9, 2008 6:47:32 PM(UTC)
Taff

Rank: Newbie

Groups: Registered, Registered Users
Joined: 3/4/2008(UTC)
Posts: 4

Yup i'm looking for something similar but with dmi cross and prev day high or low for the stops.. The ones above are too complicated to follow just off a chart without metastock..
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.