cs=(CLOSE-LLV(LOW,6))/(HHV(HIGH,6)-LLV(LOW,6))*100;
a=EMA(cs,3,1);
b=EMA(a,2,1);
e=3*a-2*b;
LOWV:=LLV(LOW,8);
HIGHV:=HHV(HIGH,8);
RSV:=EMA((CLOSE-LOWV)/(HIGHV-LOWV)*100,3);
上:=EMA(RSV,3),colorlimagenta;
下:=MA(上,3),colorliblue;
A1:=BARSLAST(REF(CROSS(e,b),1));
底:=REF(CLOSE,A1+1)>CLOSE AND e>REF(e,A1+1) AND CROSS(e,b);
A2:=BARSLAST(REF(CROSS(b,e),1));
顶:=REF(CLOSE,A2+1)<CLOSE AND REF(b,A2+1)>b AND CROSS(b,e);
DRAWTEXT(CROSS(上,18),20,'加'),colorcyan;
DRAWTEXT(CROSS(上,78),80,'警'),coloryellow;
DRAWTEXT(CROSS(96,e) AND (e<=80),60,'回调'),colorred;
DRAWTEXT(CROSS(e,1) AND (e<=20),40,'反弹'),colorbrown;
DRAWTEXT(底>0,-10,'KDJ底'),colorgreen;
DRAWTEXT(顶>0,100,'KDJ顶'),COLORFF00FF;
趋势线:MA(3*SMA((C-LLV(L,27))/(HHV(H,27)-LLV(L,27))
*100,5,1)-2*
SMA(SMA((C-LLV(L,27))/(HHV(H,27)-LLV(L,27))
*100,5,1),3,1),5),LINETHICK2,colorred;
LC:=REF(CLOSE,1);
RSI:=SMA(MAX(CLOSE-LC,0),12,1)/SMA(ABS(CLOSE-LC),12,1)*100;
RSIE:=EMA(RSI,3);
DIFF :=EMA(RSIE,12) - EMA(RSIE,26);
BBDIFF:=DIFF-REF(DIFF,1);
DEA :=EMA(DIFF,9);
BBDEA:=DEA-REF(DEA,1);
A3:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A3+1)>CLOSE AND DIFF>REF(DIFF,A3+1) AND
CROSS(DIFF,DEA);
A4:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A4+1)<CLOSE AND REF(DIFF,A4+1)>DIFF AND
CROSS(DEA,DIFF);