DIF:EMA(CLOSE,12) - EMA(CLOSE,26),LINETHICK0;

DEA:EMA(DIF,9),LINETHICK0;

A1:=BARSLAST(REF(CROSS(DIF,DEA),1));

B1:=REF(C,A1+1)>C AND REF(DIF,A1+1)<DIF AND CROSS(DIF,DEA);

A2:=BARSLAST(REF(CROSS("KDJ.K"(9,3,3),"KDJ.D"(9,3,3)),1));

B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS

("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));

A3:=BARSLAST(REF(CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));

B3:=REF(C,A3+1)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND CROSS

("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));

C1:=BARSLAST(REF(CROSS(DEA,DIF),1));

D1:=REF(C,C1+1)<C AND REF(DIF,C1+1)>DIF AND CROSS(DEA,DIF);

C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));

D2:=REF(C,C2+1)<C AND REF("KDJ.K"(9,3,3),C2+1)>"KDJ.K"(9,3,3) AND CROSS

("KDJ.D"(9,3,3),"KDJ.K"(9,3,3));

C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));

D3:=REF(C,C3+1)<C AND REF("RSI.RSI1"(6,12,24),C3+1)>"RSI.RSI1"(6,12,24) AND CROSS

("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));

STICKLINE(B1>0,110,100,3,0),COLORRED;

DRAWTEXT((B1>0),104.5,' MACD底背离'),COLORRED;

STICKLINE(D1>0,110,100,3,0),COLORFF8000;

DRAWTEXT((D1>0),104.5,' MACD顶背离'),COLORFF8000;

STICKLINE(B2>0,0,-10,3,0),COLORFA00FA;

DRAWTEXT((B2>0),-6,' KDJ底背离'),COLORFA00FA;

STICKLINE(D2>0,0,-10,3,0),COLORGREEN;

DRAWTEXT((D2>0),-6,' KDJ顶背离'),COLORGREEN;

STICKLINE(B3>0,-20,-10,3,0),COLORYELLOW;

DRAWTEXT((B3>0),-15,' RSI底背离'),COLORYELLOW;

STICKLINE(D3>0,-20,-10,3,0),COLORCYAN;

DRAWTEXT((D3>0),-15,' RSI顶背离'),COLORCYAN;

RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*100;

K:SMA(RSV,9,3),LINETHICK0;

D:SMA(K,9,3),LINETHICK0;

J:3*K-2*D,LINETHICK0;

A:=CROSS(DIF,DEA) AND CROSS(K,D) AND CROSS(J,D);

STICKLINE(A,0,100,3,0),COLORYELLOW;

DRAWICON(A,92,25);DRAWICON(A,42,25);

DRAWTEXT(A,93,' ★MACD_KDJ金叉共振'),COLORYELLOW;

DRAWTEXT(A,43,' ★KDJ_MACD金叉共振'),COLORYELLOW;