I'm only new to Metastock and I've been examining one of Jose's downloads (Pattern 01) from Metastocktools.com.
I understand the first half, but I'm not sure about the rest. (from Init:= to the end)
Hopefully someone can give me a few clues.
My interpretation is that:
The remainder of the script is to ensure that there are not 2 "in" signals before an "out" signal
In: and Out: can only be 1 or 0
Therefor init: can only be true when both In: and Out: =1
From there on I'm pretty well stumped.
x:=Input("Consecutive Lower Closes - Entry",0,21,5);
y:=Input("Consecutive Higher Closes - Exit",0,21,5);
delay:=Input("Entry and Exit delay",0,5,0);
plot:=Input("signals: [1]Clean, [2]All",1,2,1);
In:=Sum(C<Ref(C,-1),x)=x;
Out:=Sum(C>Ref(C,-1),y)=y;
Init:=Cum(In+Out>-1)=1;
InInit:=Cum(In)=1;
flag:=BarsSince(Init OR In)<BarsSince(Init OR Out)+InInit;
signals:=(InInit AND Alert(InInit=0,2) OR flag AND Alert(flag=0,2))-(flag=0 AND Alert(flag,2));
Also, when I'm confused when trying to run the script in expert advisor.
If I create a buy signal using the In: variable, I get multiple buy signals before a sell signal.
If I use the entire script in the buy formula, I get a buy signal on every bar.
Do I have to introduce a latch into my exploration or am I doing something wrong?
Thanks for your help