ZZ:=Zig(C,17,%);
X:=BarsSince(ZZ<Ref(ZZ,-1)AND Ref(ZZ,-1)>Ref(ZZ,-2));
X1:=LastValue(X)+1; {Flag Duration}
X2:=X1+1;
SD:=Stdev(C,X2);
PERIOD:=22;
COEF:=.1;
INTRA:=Log(H)-Log(L);
VINTRA:=Stdev(INTRA,PERIOD);
INTER:=Log(Typical())-Log(Ref(Typical(),-1));
VINTER:=Stdev(INTER,PERIOD);
CUTOFF:=COEF*(VINTER+VINTRA)*C;
MF:=C-(H+L)/2+Typical()-Ref(Typical(),-1);
FVE:=Sum(If(MF>CUTOFF,+V, If(MF<-CUTOFF, -V,0)),PERIOD)/Mov(V,PERIOD,S)/PERIOD*100;
X1<21 AND X1>2 AND {Condition 1}
Ref(LinRegSlope(C, 13)/Ref(C,-13)*100,-X1)>2.2 {Condition 2}
AND Ref(LinRegSlope(C,X2)/Ref(C,-X2),-1)*100<.2 AND LinRegSlope(C,X1)/Ref(C,-X1)>-1.2 {Condition 3}
AND Ref(LinRegSlope(V,X2)/Ref(V,-X2),-1)*100<-2 {Condition 4}
AND Ref(LinRegSlope(SD,X1),-1)<0 {Condition 5}
AND Stoch(20,3)>55 AND ADX(10)>30 {Condition 6}
AND FVE>10 AND Fml("VFI")>-3 {Condition 7}
AND C>Ref(C,-1) AND C>0 {Condition 8}