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

Notification

Icon
Error

Options
Go to last post Go to first unread
garp  
#1 Posted : Saturday, April 26, 2008 9:05:43 PM(UTC)
garp

Rank: Member

Groups: Registered, Registered Users, Subscribers
Joined: 11/23/2005(UTC)
Posts: 22
Location: Chicago, Illinois

Ciao,

Why won't this work? OK, I'm developing a system where I need to track system states to keep indicators from cluttering my chart. These "latches" will not work for me so I put together this proof of concept piece to try to debug, pretty much stright out of the manual. This system will display one enter signal, then one short enters, then ,,,, nothing! Can someone who knows this function tell me what's wrong with my code?

Enter Long
fastMA:=Mov(C,7,S);
slowMA:=Mov(C,21,S);
stochInd:=Stoch(5,3);
LE:=Cross( fastMA, slowMA )
OR
Cross(stochInd,20);
SE:=0;
LX:=0;
SX:=0;
B:= ExtFml("forum.Latch",LE,LX,SE,SX);
B = 1 AND Ref(B,-1) <> 1

Enter Short
fastMA:=Mov(C,7,S);
slowMA:=Mov(C,21,S);
stochInd:=Stoch(5,3);
SE:=Cross( slowMA, fastMA )
OR
Cross(80, stochInd );
LE:=0;
LX:=0;
SX:=0;
B:= ExtFml("forum.Latch",LE,LX,SE,SX);
B = -1 AND Ref(B,-1) <> -1

Exit Long
stochInd:=Stoch(5,3);
LX:=Cross(90,stochInd);
LE:=0;
SE:=0;
SX:=0;
B:= ExtFml("forum.Latch",LE,LX,SE,SX);
B = 0 AND Ref(B,-1) = 1

Exit Short
stochInd:=Stoch(5,3);
SX:=Cross(stochInd,10);
LE:=0;
LX:=0;
SE:=0;
B:= ExtFml("forum.Latch",LE,LX,SE,SX);
B = 0 AND Ref(B,-1) = -1

I appreciate the aid,

Garp

woof woof

wabbit  
#2 Posted : Saturday, April 26, 2008 9:55:12 PM(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)
Garp,

I don't think you have fully grasped the "latch" concept, so I hope the explanations below will help...

Code:

{Enter Long}
fastMA:=Mov(C,7,S);
slowMA:=Mov(C,21,S);
stochInd:=Stoch(5,3);
LE:=Cross( fastMA, slowMA )
OR
Cross(stochInd,20);
SE:=0;
LX:=0;
SX:=0;
B:= ExtFml("forum.Latch",LE,LX,SE,SX);
B = 1 AND Ref(B,-1) <> 1

This will plot a value of 1 on the first instance when the LE condition is true. As you never exit this "trade" there will only ever be one spike. The latch thinks it is already in a long trade and will not give any more signals until this trade is exited.

Code:

{Enter Short}
fastMA:=Mov(C,7,S);
slowMA:=Mov(C,21,S);
stochInd:=Stoch(5,3);
SE:=Cross( slowMA, fastMA )
OR
Cross(80, stochInd );
LE:=0;
LX:=0;
SX:=0;
B:= ExtFml("forum.Latch",LE,LX,SE,SX);
B = -1 AND Ref(B,-1) <> -1

This will plot a value of 1 on the first instance when the SE condition is true. The logic is the same as for the LE (above).

Code:

{Exit Long}
stochInd:=Stoch(5,3);
LX:=Cross(90,stochInd);
LE:=0;
SE:=0;
SX:=0;
B:= ExtFml("forum.Latch",LE,LX,SE,SX);
B = 0 AND Ref(B,-1) = 1

As no long trades are ever entered, all the exit signals are ignored.

Code:

{Exit Short}
stochInd:=Stoch(5,3);
SX:=Cross(stochInd,10);
LE:=0;
LX:=0;
SE:=0;
B:= ExtFml("forum.Latch",LE,LX,SE,SX);
B = 0 AND Ref(B,-1) = -1

As no short trades are ever entered, all the exit signals are ignored.

As has been mentioned before, the Forum.dll latch is a very generic system and does not necessarily match every trader's logic. You can "see" how the latch performs by viewing the truth table at http://forum.equis.com/forums/permalink/16453/16453/ShowThread.aspx#16453
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.