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

Notification

Icon
Error

Options
Go to last post Go to first unread
johnl  
#1 Posted : Thursday, January 5, 2006 5:48:34 PM(UTC)
johnl

Rank: Advanced Member

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

Here is something someone can help me with. A lot of signals I come up with kick in too many times so I find I need to weed out some of the signals in order to focus more. I am looking for some generic code: Given 2 formulas both either a spike of 1 else 0 at any given time I need some clean logic: a1:= Fml("a"); a2:= Fml("b"); etc,etc code that will give me 1 on the first instance of a2=1 after a1=1 that will give me 1 on the second instance of a2=1 after a1=1 the code should be generic enough so that as long as a1,a2 are spikes of 1 else 0 then I can copy and replace for the two formulas without have to think too much. I have come up with something that works but is messy and not generic. Thanks..
mstt  
#2 Posted : Thursday, January 5, 2006 7:12:49 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)
john This sounds like a situation where a latch would be useful. {example 1} a1:= Fml("a"); a2:= Fml("b"); i:=Cum(a1+a2>-1)=1; {initialixation - inputs are valid} x:=BarsSince(i OR a1)<BarsSince(i OR a2); {latch} x:=Alert(x,2) AND a2; {first a2 after a1} x; {example 2} a1:= Fml("a"); a2:= Fml("b"); x:=ExtFml("Forum.Latch",a1,a2,0,0); x:=Alert(x,2) AND a2; x; Roy MetaStock Tips & Tools
johnl  
#3 Posted : Friday, January 6, 2006 4:10:35 AM(UTC)
johnl

Rank: Advanced Member

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

That should do it. Thanks.
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.