MACD二次金叉副图指标
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:(DIFF-DEA)*2,COLORSTICK;
SR:=IF(MACD>0,SUM(MACD,BARSLAST(MACD<0)),0),COLOR0000FF;
SG:=IF(MACD<0,SUM(MACD,BARSLAST(MACD>0)),0),COLOR006000;
低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
DRAWTEXT(低位金叉,ABS(DEA),'低位金叉'),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,6,0),COLORFF00FF;
DRAWICON(二次金叉,DEA*0.9,1) ;
DRAWTEXT(二次金叉,ABS(DEA)*1.3,' 二次金叉'),COLORYELLOW;
A1:=BARSLAST(CROSS(DIFF,DEA));
A2:=BARSLAST(CROSS(DEA,DIFF));
A3:=BARSLAST(CROSS(DIFF,DEA));
A4:=BARSLAST(CROSS(DEA,DIFF));
底背离:= LLV(CLOSE,A2)<REF(LLV(CLOSE,A4-A3),A3) AND LLV(DIFF,A2)>REF(LLV(DIFF,A4-A3),A3) AND CROSS(DIFF,DEA);
DRAWLINE(REF(CROSS(DIFF,DEA),1),DEA,底背离,DEA,0),COLORLIBLUE,LINETHICK2;
DRAWTEXT(底背离,DEA,'底背离'),COLORLIBLUE;
顶背离:= HHV(CLOSE,A1)>REF(HHV(CLOSE,A3-A4),A4) AND HHV(DIFF,A1)<REF(HHV(DIFF,A3-A4),A4) AND CROSS(DEA,DIFF);
DRAWLINE(REF(CROSS(DEA,DIFF),1),DEA,顶背离,DEA,0),COLORGRAY,LINETHICK2;
DRAWTEXT(顶背离,DEA,'顶背离'),COLORGRAY;
DRAWTEXT(低位金叉 AND 二次金叉 AND 底背离,ABS(DEA)*1.5,'三全项'),COLORRED,LINETHICK2;