DIF:EMA(CLOSE,6)-EMA(CLOSE,19),,NODRAW;
DEA:EMA(DIF,9),NODRAW;
:2*(DIF-DEA),COLORSTICK;
DIFF:DIF,COLORRED,LINETHICK1;
DDEA:DEA,COLORGREEN,LINETHICK1;VAR1:=3*SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1)
-2*SMA(SMA((C-LLV(L,55))/(HHV(H,55)-LLV(L,55))*100,5,1),3,1);
STICKLINE(MACD 0 AND MACD =REF(MACD,1),0,MACD,5,0),COLOR0000FF;
STICKLINE(MACD 0 AND MACD REF(MACD,1),0,MACD,5,0),COLORFFFF00;
STICKLINE(MACD 0 AND MACD =REF(MACD,1),0,MACD,5,0),COLORFF00FF;
STICKLINE(MACD 0 AND MACD REF(MACD,1),0,MACD,5,0),COLOR00FF00;
多转空:=((((LLV(MACD,4) 0) AND (MACD REF(MACD,1))) AND (REF(MACD,1) REF(MACD,2))) AND (REF(MACD,2) REF(MACD,3)));
空转多:=((((HHV(MACD,4) 0) AND (MACD REF(MACD,1))) AND (REF(MACD,1) REF(MACD,2))) AND (REF(MACD,2) REF(MACD,3)));
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
底背离:=REF(CLOSE,A1+1) CLOSE AND DIFF REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
STICKLINE(底背离,0,1.5,3,0),COLOR00FF00;
DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK2;
DRAWTEXT(底背离,-0.5, 底背离 ),COLOR00FF00;
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
顶背离:=REF(CLOSE,A2+1) CLOSE AND REF(DIFF,A2+1) DIFF AND CROSS(DEA,DIFF);
STICKLINE(顶背离,0,2,3,0),COLORFF8855;
DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORFF8855,LINETHICK2;
DRAWTEXT(顶背离,1, 顶背离 ),COLORFF8855;
轴:0,COLORCYAN;