RSV:=(((CLOSE - LLV(LOW,9)) / (HHV(HIGH,9) - LLV(LOW,9))) * 100);
K:=SMA(RSV,3,1);
D:=SMA(K,3,1);
J:=3*K-2*D;
BB:=IF(crOSS(J,3),65,0);
VA:=(2*C+H+L)/4;
VB:=LLV(L,5);
VC:=HHV(H,5);
LB:=EMA((VA-VB)/(VC-VB)*100,5);
LS:=EMA(LB,3),COLORFFFF00;
TREND:=3*SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1)-2*SMA(SMA((CLOSE-LLV(LOW,27))/(HHV(HIGH,27)-LLV(LOW,27))*100,5,1),3,1);
BA:=IF(TREND<=3,20,0);
RD1:=REF(BA,1) AND REF(BB,1) AND REF(CROSS(LB,LS),1) AND TREND>5;
RD2:=REF(BA,1) AND REF(BB,1) AND CROSS(LB,LS) AND TREND>5;
XG:RD1 OR RD2;