LC:=REF(CLOSE,1);
TR0:=MAX((HIGH - LOW),MAX((HIGH - LC),(LC - LOW)));
AT:=SMA(TR0,20,1);
AA:=(HHV(HIGH,20) - (2 * AT));
DD:=CROSS(CLOSE,REF(HHV(HIGH,55),1));
SSS:=CROSS(MIN(MA(CLOSE,13),AA),CLOSE);
BBB:=BARSLAST(DD);
SSSB:=BARSLAST(SSS);
A1:=((BBB = 0) AND (REF(SSSB,1) < REF(BBB,1)));
A2:=BARSLAST(A1);
XG:((((DD = 1) AND (A2 < SSSB)) AND (A2 > 0)) AND (COUNT(DD,SSSB) < 3));