N:=9;M1:=3;M2:=3;P:=9;
AA:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
BB:=SMA(AA,M1,1);
ELIA:=SMA(BB,M2,1);
ELIB:=IF(BARSLAST(CROSS(BB,ELIA))<P AND CROSS(BB,ELIA) AND BB<20,90,0);
LC:=REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LC,0),4.1,1)/SMA(ABS(CLOSE-LC),4.1,1)*100;
CC:=CROSS(RSI,11)*80;
XG:CC OR ELIB;