Rank: Member
Groups: Registered, Registered Users, Subscribers Joined: 5/27/2005(UTC) Posts: 17
|
ma1:=Mov(C,5,S); ma2:=Mov(C,10,S);
entry:=Cross(ma1,ma2); exit:=C=LLV(C,21);
init:=Cum(IsDefined(entry+exit))=1; bin:=ValueWhen(1,entry-exit<>0 OR init,entry);
I want to enter, not on the first but on the 2nd, 3rd, 4th entry signal. The exit is the same.
How do I tell Metastock to only consider the second, third,...cross(entry)?
|
|
|
|
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)
|
Use a count and reset system: Code:
ma1:=Mov(C,5,S);
ma2:=Mov(C,10,S);
entry:=Cross(ma1,ma2);
exit:=C=LLV(C,21);
{counter}
count:=cum(entry);
reset:=exit;
counter:=count-valuewhen(1,reset,count);
{discrete signals}
LE:=counter>1 AND ROC(counter,1,%)>0;
LX:=ROC(counter,1,%)<0;
{plot}
LE-LX;
wabbit [:D]
|
|
|
|
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.