DIF:EMA(CLOSE,12) - EMA(CLOSE,26),COLOR33FF33;DEA:EMA(DIF,9),coloryellow;MACD:2*(DIF-DEA),NODRAW,colormagenta;MACD2:=REF(MACD,1);DRAWTEXT(CROSS(DIF,0),DIF,'DIF上0');DRAWTEXT(CROSS(0,DIF),0.1,'DIF下0');金叉:=CROSS(DIF,DEA);下叉:=CROSS(DEA,DIF);DD:=C=LLV(C,60);DDSJ:=BARSLAST(REF(DD,1));DDGJ:=REF(CLOSE,DDSJ+1)>CLOSE;GD:=C=HHV(C,30);GDSJ:=BARSLAST(REF(GD,1));GDGJ:=REF(CLOSE,GDSJ+1)<CLOSE;MDZB:=REF(DIF,DDSJ+1)<DIF;M底背离:=DDGJ AND MDZB;MGZB:=REF(DIF,GDSJ+1)>DIF;M顶背离:=GDGJ AND MGZB;底背:=RANGE(BARSLAST(M底背离),1,7) AND CROSS(DIF,DEA);DRAWTEXT(M顶背离,DIF-0.01,'顶背'),LINETHICK2,colormagenta;DRAWTEXT(底背,0.2,'抄底背'),LINETHICK2,colormagenta;ES:=REF(EMA(C,26),1);EP:=REF(EMA(C,12),1);DI:=REF(DIF,1);DRAWTEXT(金叉,DIF+0.1,'金'),LINETHICK2,colormagenta;DRAWTEXT(下叉,DIF-0.1,'下'),LINETHICK2,colormagenta;JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));STICKLINE(MACD>MACD2 ,0,MACD,1,0),colorred;STICKLINE(MACD<MACD2 ,0,MACD,1,0),colorgreen;STICKLINE(MACD>MACD2 AND MACD<0 ,0,MACD,1,1),colorred;STICKLINE(MACD<MACD2 AND MACD>0 ,0,MACD,1,1),colorgreen;M1:=MACD;VA1:=HHVBARS(M1,BARSLAST(M1<0)+1);VA2:=CROSS(BACKSET(CROSS(0,M1),REF(VA1,1)+2),0.5);QG:=CROSS(BACKSET(CROSS(0,M1) OR (ISLASTBAR AND M1>0),REF(VA1,1)+2),0.5);前高:DRAWLINE(VA2,M1,REF(VA2,1),REF(M1,1),1),colormagenta;VA3:=LLVBARS(M1,BARSLAST(M1>0)+1);VA4:=CROSS(BACKSET(CROSS(M1,0),REF(VA3,1)+2),0.5);BD:=BARSLAST(FILTERX(CROSS(0,M1),BARSCOUNT(C)));前低:DRAWLINE(VA4,M1,REF(VA4,1),REF(M1,1),1);DRAWICON(CROSS(DIF*1.04,前高),前高,34);跌几天:BARSLAST(REF(MACD,1)<MACD),NODRAW;涨几天:BARSLAST(REF(MACD,1)>MACD ),NODRAW;