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

Notification

Icon
Error

Options
Go to last post Go to first unread
R3Girls-FNG  
#1 Posted : Wednesday, May 26, 2010 1:05:41 PM(UTC)
R3Girls-FNG

Rank: Newbie

Groups: Registered, Registered Users
Joined: 12/18/2007(UTC)
Posts: 5

All, in the June 2010 edition of TASC, Walter Downs speaks of his Forex Gambit trading system.

I've started in a very elementary fashion what some of the code may look like, but so far, Metastock hasn't liked it a bit. Please help.

Buy : Buy two lower lows and a closing price that is greater than the midpoint of the bar and is above the SMA

My code:

L<(Ref(L,-1) AND Ref(L,-1)<Ref(L,-2))
AND
((H-L)/2)> Mov(C,30,S)
AND
C>((H-L)/2)

Exit Long: When a bar occurs whose range is greater than the previous three ranges and whose close is in the top 10% of the bar, exit a long position on the first closing price that is lower than the previous closing price OR exit after 16 days.

My code:

(((H-L)>Ref((H-L),-1)
AND
(H-L)>Ref((H-L),-2)
AND
(H-L)>Ref((H-L),-3)
AND
C>Mul((H-L) ,(.9)))
AND
C< Ref(C,-1))

OR

BarsSince((L<(Ref(L,-1) AND Ref(L,-1)<Ref(L,-2))

AND

((H+L)/2)> Mov(C,30,S)

AND

C>((H+L)/2)))=16

I'm pretty elementary when it comes to programming, so please give me any pointers you can.

Thanks.

johnl  
#2 Posted : Wednesday, May 26, 2010 8:04:56 PM(UTC)
johnl

Rank:: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602


Write your code like this and it is easier to see what is going on.

a1:=(L<Ref(L,-1))*(Ref(L,-1)<Ref(L,-2));
a2:=((H-L)/2)>Mov(C,30,S);
a3:=C>((H-L)/2);
a1;a2;a3;

Color each plot a different color and modify the code accordingly.
R3Girls-FNG  
#3 Posted : Sunday, June 6, 2010 9:39:19 AM(UTC)
R3Girls-FNG

Rank: Newbie

Groups: Registered, Registered Users
Joined: 12/18/2007(UTC)
Posts: 5

Thanks.

I had to modify the line a2 and a3.

a1:=(L<Ref(L,-1))*(Ref(L,-1)<Ref(L,-2));

a2:=(H-((H-L)/2)>Mov(C,30,S));

a3:=C>(H-((H-L)/2))

Now, I think I can set up an advisor to say if buy if a1+a2+a3 = 3.

Off to find someone else's idea to copy, I suppose.

johnl  
#4 Posted : Monday, June 7, 2010 8:32:39 PM(UTC)
johnl

Rank:: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

You could also watch the videos available through the forum to watch how the
plug-in folks approach putting trading strategies together for ideas.
Mark17  
#5 Posted : Wednesday, June 9, 2010 4:25:28 AM(UTC)
Mark17

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/25/2010(UTC)
Posts: 55

Is the * in a1 equivalent to "and"?
johnl  
#6 Posted : Wednesday, June 9, 2010 8:14:35 PM(UTC)
johnl

Rank:: Advanced Member

Groups: Registered, Registered Users
Joined: 11/7/2005(UTC)
Posts: 602

Yes
Mark17  
#7 Posted : Thursday, June 10, 2010 4:40:44 AM(UTC)
Mark17

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 5/25/2010(UTC)
Posts: 55

I've never seen * be anything but a multiplier; what about this line of code relegates it to "and?" Thanks.
vienna  
#8 Posted : Thursday, June 10, 2010 7:45:19 AM(UTC)
vienna

Rank: Advanced Member

Groups: Registered, Registered Users, Subscribers
Joined: 12/14/2009(UTC)
Posts: 140
Location: Austria

it's still a mulitplier but multiplying with 0/1 values is the same as an AND

1 * 1 = 1
1 AND 1 = 1
1 * 0 = 0
1 AND 0 = 0
0 * 1 = 0
0 AND 1 = 0

0 * 0 = 0
0 AND 0 = 0

+ can be used as an OR

1 + 1 = 2 (which is in metastocks if you use it logical = 1)
1 OR 1 = 1
1 + 0 = 1
1 OR 0 = 1
0 + 1 =1
0 OR 1 = 1
0 + 0 = 0
0 OR 0 = 0


best regards
ts
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.