DIF:EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:EMA(DIF,9);
MACD:(DIF-DEA)*2,COLORSTICK;
低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1;
JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA);
DRAWTEXT(EXIST(低位金叉=1,1),低位金叉*(-0.3),'↖低位金叉'),COLORYELLOW;
DRAWTEXT(EXIST(二次金叉=1,1),二次金叉*(-0.4),'↖二次金叉'),COLORRED;
DRAWTEXT(EXIST(底背离=1,1),底背离*(-0.5),'↖底背离'),COLORGREEN;