Basic formula for Stoch Weekly Binary.
 Starting point for expert, explorations, system tests etc.
 

 {Stochastic Weekly Binary Simple}
 {Plot Green}
 fri:=DayOfWeek()=5;
 new:=ROC(DayOfWeek(),1,$)<0;
 next:= fri OR (new AND Ref(fri,-1)=0);
 

 ll:=LowestSince(5,new,L);
 hh:=HighestSince(5,new,H);
 

 c1:=Cum(If(fri,(C-ll),
 If(next,(Ref(C-ll,-1)),0)));
 c2:=Cum(If(fri,(hh-ll),
 If(next,(Ref(hh-ll,-1)),0)));
 

 denom:=c2-ValueWhen(4,next,c2);
 check:=If(denom=0,-1,denom);
 wsto:=If(check=-1,50,
 ((c1-ValueWhen(4,next,c1))/check)*100);
 
 wsto>ValueWhen(1,next,Ref(wsto,-1));
 

 {Plot Red}
 fri:=DayOfWeek()=5;
 new:=ROC(DayOfWeek(),1,$)<0;
 next:= fri OR (new AND Ref(fri,-1)=0);
 

 ll:=LowestSince(5,new,L);
 hh:=HighestSince(5,new,H);
 

 c1:=Cum(If(fri,(C-ll),
 If(next,(Ref(C-ll,-1)),0)));
 c2:=Cum(If(fri,(hh-ll),
 If(next,(Ref(hh-ll,-1)),0)));
 

 denom:=c2-ValueWhen(4,next,c2);
 check:=If(denom=0,-1,denom);
 wsto:=If(check=-1,50,
 ((c1-ValueWhen(4,next,c1))/check)*100);
 wsto<ValueWhen(1,next,Ref(wsto,-1));
 

 

 

Reply via email to