通达信macd红绿柱面积显示
macd低位2金叉
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA), COLORSTICK,LINETHICK2;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
STICKLINE(低位金叉,0,0.08,6,0),COLORYELLOW;
DRAWTEXT(低位金叉,0.16,' 金叉'),COLORWHITE;
JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(二次金叉,0,0.06,2,0),COLORFF00FF;
DRAWICON(二次金叉,DEA*0.9,1) ;
DRAWTEXT(二次金叉,0.2,' 二金叉'),COLORYELLOW;
{红绿柱面积显示}
红面积:SUM(MACD,BARSLAST(MACD<0))*(MACD>0),COLOR0000FF,NODRAW;
绿面积:SUM(MACD,BARSLAST(MACD>0))*(MACD<0),COLORFFFF00,NODRAW;
AA:=ROUND(REF(绿面积,1)*100);BB:=ROUND(REF(红面积,1)*100);
DRAWNUMBER(CROSS(0,MACD),HHV(REF(MACD,1),5)+0.03,ABS(BB)),COLORMAGENTA;
DRAWNUMBER(CROSS(MACD,0),LLV(REF(MACD,1),5)-0.03,ABS(AA)),COLORGREEN;
{红柱缩短提示}
H1:=REF(MACD,1)<0 AND MACD>0,NODRAW;
H1T:=BARSLAST(H1)+1,NODRAW;
H2:=IF(MACD>0,H1T,0),NODRAW;
H3:=HHV(MACD,H2),NODRAW;
L1:=REF(MACD,1)>0 AND MACD<0,NODRAW;
L1T:=BARSLAST(L1)+1,NODRAW;
HJ:=(H1T+L1T),NODRAW;
H4:=REF(H3,HJ),NODRAW;
顶背离:H3<H4 AND C>REF(C,HJ) AND MACD>0 AND MACD<REF(MACD,1),COLORGREEN,NODRAW;
STICKLINE(顶背离,0,MACD,2,0),COLORGREEN;