0,COLORRED,LINETHICK2;
20,COLORLIMAGENTA;
50,COLORWHITE;
80,COLORBLUE;
100,COLORGREEN,LINETHICK2;
DRAWTEXT(ISLASTBAR,0,'高安全区'),COLORWHITE;
DRAWTEXT(ISLASTBAR,20,'安 全 区'),COLORYELLOW,DOTLINE;
DRAWTEXT(ISLASTBAR,80,'风 险 区'),COLORBLUE,DOTLINE;
DRAWTEXT(ISLASTBAR,100,'高风险区'),COLORGREEN;
RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;
K:SMA(RSV,3,1),COLOR9FA1A1,LINETHICK2;
D:SMA(K,3,1),COLOR00A13C,LINETHICK2;
J:3*K-2*D,COLOR0089FF,LINETHICK2;
J1:="macd.DIF"(12,26,9);J2:="MacD.DEA"(12,26,9);
J3:="kdj.K"(15,6,3);J4:="kdJ.D"(15,6,3);
J5:="rsi.RSI1"(6,12,24);J6:="RSI.RSI2"(6,12,24);
A1:=BArslAST(REF(crOSS(J1,J2),1));
B1:=REF(C,A1+1)>C AND REF(J1,A1+1)
B2:=REF(C,A2+1)>C AND REF(J3,A2+1)
B3:=REF(C,A3+1)>C AND REF(J5,A3+1)
D1:=REF(C,C1+1)
C2:=BARSLAST(REF(CROSS(J4,J3),1));
D2:=REF(C,C2+1)
C3:=BARSLAST(REF(CROSS(J6,J5),1));
D3:=REF(C,C3+1)
MACD底背离:=FILTER(B1>0,5);
KDJ底背离:=FILTER(B2>0,5);
DRAWTEXT(KDJ底背离,REF(J1,A1+2),'.K底'),COLORWHITE;
RSI底背离:=FILTER(B3>0,5);
KDJ顶背离:=FILTER(D2>0,5);
DRAWTEXT(KDJ顶背离,REF(J1,D1+2),'.K顶'),COLOR0000FF;
A01:=BARSLAST(REF(CROSS(J,K),1));
底背:=REF(CLOSE,A01+1)>CLOSE AND J>REF(J,A01+1) AND CROSS(J,K);
底:DRAWLINE(A01=0,D,底背,D,0),COLORRED,POINTDOT;
DRAWTEXT(底背,D,'底B'),COLORRED;
A02:=BARSLAST(REF(CROSS(K,J),1));
顶背:=REF(CLOSE,A02+1)
顶:DRAWLINE(A02=0,D,顶背,D,0),COLORGREEN,POINTDOT;
DRAWTEXT(顶背,D,'顶B'),COLORGREEN;
AB2:=BARSLAST(REF(CROSS(K,D),1));
BB2:=REF(C,AB2+1)>LLV( L,3 ) AND REF(K,AB2+1)
BY2:=REF(C,A2+1)>REF(C,A2) AND REF(J3,A2+1)
DRAWTEXT(BY2,J,'底'),COLORLIBLUE;
BY1:=REF(C,A2+1)>REF(C,A2) AND REF(J3,A2+1)
DRAWTEXT(BY1,J,'底背离'),COLORBLUE;
HY0:=(C/REF(C,1)>=1.099) OR (NAMELIKE('S') OR NAMELIKE('*')) AND ((C-REF(C,1))/REF(C,1)*100)>=4.945 AND C=H,COLORFF00FF;
HY1:=COUNT(HY0,13)>=1;
HY2:=HY1=1 AND J<15;
DRAWICON(HY2,J,23);