以下是通达信MACD背驰逃顶抄底副图/选股预警 源码
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA),COLORSTICK,LINETHICK2;
XA_1:=CROSS(DIFF,DEA) AND DIFF<(-0.1);
STICKLINE(XA_1,0,0.08,6,0),COLORYELLOW;
XA_2:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
XA_3:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(XA_2=2,21)=1;
STICKLINE(XA_3,0,0.06,6,0),COLORMAGENTA;
DRAWICON(XA_3,DEA*0.9,1);
XA_4:=BARSLAST(REF(CROSS(DIFF,DEA),1));
XA_5:=REF(CLOSE,XA_4+1)>CLOSE AND DIFF>REF(DIFF,XA_4+1) AND CROSS(DIFF,DEA);
STICKLINE(XA_5,0,0.03,6,0),COLORGREEN;
底背:DRAWLINE(XA_4=0,DEA,XA_5,DEA,0),COLORRED,LINETHICK4;
DRAWTEXT(XA_5,0.12,’底背’),COLORMAGENTA;
XA_6:=BARSLAST(REF(CROSS(DEA,DIFF),1));
XA_7:=REF(CLOSE,XA_6+1)<CLOSE AND REF(DIFF,XA_6+1)>DIFF AND CROSS(DEA,DIFF);
顶背:DRAWLINE(XA_6=0,DEA,XA_7,DEA,0),COLORGREEN,LINETHICK4;
DRAWTEXT(XA_1 AND XA_3 AND XA_5,DIFF,’顶背’),COLORRED,LINETHICK2;
DRAWICON(CROSS(DIFF,DEA),DIFF,1);
DRAWICON(CROSS(DEA,DIFF),DIFF,2);
MACD值:2*(DIFF-DEA),COLORSTICK,COLORRED;
XA_8:=SUM(MACD值,0);
XA_9:=IF(MAX(XA_8,REF(XA_8,2))<REF(XA_8,1) OR MIN(XA_8,REF(XA_8,2))>REF(XA_8,1),1,0);
XA_10:=BARSLAST(XA_9)+1;
XA_11:=XA_8-REF(XA_8,XA_10);
XA_12:=IF(MACD值>0,HHV(ABS(MACD值),XA_10),LLV(MACD值,XA_10));
XA_13:=MACD值/20;
面积:XA_11,NODRAW;
DRAWNUMBER(REF(XA_13,1)>0 AND XA_13<=0,REF(XA_12,1),REF(面积,1)),COLORMAGENTA;
DRAWNUMBER(REF(XA_13,1)<0 AND XA_13>=0,REF(XA_12,1),REF(ABS(面积),1)),COLORGREEN;
DRAWNUMBER(ISLASTBAR AND XA_13<0,REF(XA_12,1),ABS(面积)),COLORMAGENTA;
DRAWNUMBER(ISLASTBAR AND XA_13>0,REF(XA_12,1),面积),COLORGREEN;
评论(0)