N:=27;
M0:=5;
M1:=3;
M2:=2;
top=100;
DOWN=0;
HV=HHV(HIGH,N);
LV=LLV(LOW,N);
RSV=SMA((CLOSE-LV)/(HV-LV)*100,M0,1);
K=SMA(RSV,M1,1);
D=SMA(K,M2,1);
J: RSV*5-K*3-D,LINETHICK1,colorred;
JM: EMA(MA(J,M0),M1),LINETHICK1,colorcyan;
STICKLINE(J>=JM,J,JM,1,0),COLOR7F52AF;
STICKLINE(J<JM,J,JM,1,0),COLORA6B8C1;
STICKLINE(J>TOP AND J>=JM,J,TOP,1,0),COLORFF0000;
STICKLINE(JM>TOP AND J<JM,JM,TOP,1,0),COLORFFFFFF;
STICKLINE(J<0 AND J<JM,J,0,1,0),COLORF00FF0;
STICKLINE(JM<0 AND J>JM,JM,0,1,0),COLORF0F000;
V1:= MA(CLOSE,5)=HHV(MA(CLOSE,5),20);
V2:= MA(CLOSE,5)>MA(CLOSE,20);
V3:= COUNT(MA(CLOSE,1)>REF(CLOSE,1),3)=3;
风险1级: IF(V1 AND V2 AND V3,18,0),colorgreen;
V11:= MA(CLOSE,5)=HHV(MA(CLOSE,5),120);
V21:= MA(CLOSE,5)>MA(CLOSE,120);
V31:= COUNT(MA(CLOSE,1)>REF(CLOSE,1),3)=3;
风险2级: IF(V11 AND V21 AND V31,20,0),colorcyan;
底部: DOWN,colorgreen;
STICKLINE(crOSS(J,底部),0,-18,2,0),COLOR00FF00;
DRAWTEXT(CROSS(J,底部),-8,'底'),COLOR0000FF;
顶部: TOP,coloryellow;
STICKLINE(CROSS(顶部,J),TOP+18,TOP,3,0),COLORFF9D00;
DRAWTEXT(CROSS(顶部,J),TOP+28,'顶'),COLORFF9D00;