N:=9; P1:=3; P2:=3;
RSV:=(CLOSE-LLV(LOW,N))/(HHV(HIGH,N)-LLV(LOW,N))*100;
K:SMA(RSV,P1,1);
D:SMA(K,P2,1);
J:3*K-2*D;
DRAWICON(CROSS(K,D),K,1);
DRAWICON(CROSS(D,K),D,2);
X1:KD.K#MONTH;
X2:=KD.D#MONTH;
X3:=KD.K#WEEK;
X4:=KD.D#WEEK;
X5:=KD.K#SEASON;
X6:KD.D#SEASON;
Y1:X1>X2;
Y2:X2>X1;
Z1:=X3>X4;
Z2:=X4>X3;
J1:X5>X6;
J2:X6>X5;
R1:=K>D;
R2:=D>K;
R3:=K<20;
R4:=K>=20 AND K<50;
R5:=K>=50 AND K<80;
R6:=K>=80;
YTD1:=STRCAT('',IF(Y1,'月KD金叉',' '));
DRAWTEXT_FIX(1,0.1,0.00,0,YTD1),COLORRED;
YTD2:=STRCAT('',IF(Y2,'月KD死叉',' '));
DRAWTEXT_FIX(1,0.1,0.00,0,YTD2),COLORGREEN;
JTD1:=STRCAT('',IF(J1,'季KD金叉',' '));
DRAWTEXT_FIX(1,0.05,0.00,0,JTD1),COLORRED;
JTD2:=STRCAT('',IF(J2,'季KD死叉',' '));
DRAWTEXT_FIX(1,0.05,0.00,0,JTD2),COLORGREEN;
ZTD1:=STRCAT('',IF(Z1,'周KD金叉',' '));
DRAWTEXT_FIX(1,0.15,0.00,0,ZTD1),COLORRED;
ZTD2:=STRCAT('',IF(Z2,'周KD死叉',' '));
DRAWTEXT_FIX(1,0.15,0.00,0,ZTD2),COLORGREEN;
RTD1:=STRCAT('',IF(R1,'日KD金叉',' '));
DRAWTEXT_FIX(1,0.2,0.00,0,RTD1),COLORRED;
RTD2:=STRCAT('',IF(R2,'日KD死叉',' '));
DRAWTEXT_FIX(1,0.2,0.00,0,RTD2),COLORGREEN;
RTD3:=STRCAT('',IF(R3,'日K值在20下面运行',' '));
DRAWTEXT_FIX(1,0.25,0.00,0,RTD3),COLORRED;
RTD4:=STRCAT('',IF(R4,'日K值在20至50之间运行',' '));
DRAWTEXT_FIX(1,0.25,0.00,0,RTD4),COLORRED;
RTD5:=STRCAT('',IF(R5,'日K值在50至80之间运行',' '));
DRAWTEXT_FIX(1,0.25,0.00,0,RTD5),COLORRED;
RTD6:=STRCAT('',IF(R6,'日K值在80上面运行',' '));
DRAWTEXT_FIX(1,0.25,0.00,0,RTD6),COLORRED;
IF(J<0,J,DRAWNULL),COLORGREEN,LINETHICK2;
IF(K>90,K,DRAWNULL),COLOR0000FF,LINETHICK2;
IF(D>85,D,DRAWNULL),COLORFFFF11,LINETHICK2;
DRAWICON(CROSS(J,1),J,1);
DRAWICON(K>80 AND D>80 AND CROSS(D,K),D,2);
DRAWTEXT(K>80,90,'★'),COLORRED;
DRAWTEXT(K<20,-5,'★'),COLORYELLOW;
DRAWTEXT(CROSS(80,K),80,'逃'),COLORYELLOW;