MA5:=EMA(C,5);
MA13:=EMA(C,13);
Y1:=LLV(L,BARSLAST(CROSS(MA13,MA5))+1);
Y2:=HHV(H,BARSLAST(CROSS(MA5,MA13))+1);
Y3:=HHV(H,BARSLAST(CROSS(MA5,MA13))+1);
Y4:=LLV(L,BARSLAST(CROSS(MA13,MA5))+1);
E1:=EVERY(RANGE(MA(Y3,5)/MA(Y1,5),0.93,1.2),5);
E2:=EVERY(RANGE(MA(Y3,13)/MA(Y1,13),0.93,1.2),13);
E3:=EVERY(RANGE(MA(Y4,5)/MA(Y3,5),0.93,1.2),5);
E4:=EVERY(RANGE(MA(Y4,13)/MA(Y3,13),0.93,1.2),13);
VAR1:=C-REF(C,1);
VAR2:=100*EMA(EMA(VAR1,6),6)/EMA(EMA(ABS(VAR1),6),6);
BT:=(LLV(VAR2,2)=LLV(VAR2,7) AND COUNT(VAR2<0,2) AND CROSS(VAR2,MA(VAR2,2))) AND
E1 AND E2 AND E3 AND E4;
XG: COUNT(BT,20)=1;