DIF:=EMA(CLOSE,SHORT) - EMA(CLOSE,LONG);
DEA:=EMA(DIF,M);
MACD:=2*(DIF-DEA);
Var1:=LONGCROSS(DIF,DEA,2) AND DIF<-0.1;
DRAWTEXT(Var1,1,' 低位 金叉'),colorred,ALIGN1;
STICKLINE(Var1 ,0 ,1 ,6 , 0),colorred;
JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
Var2:=LONGCROSS(DIF,DEA,2) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
STICKLINE(Var2 ,0 ,0.75 ,6 , 0),coloryellow;
DRAWTEXT(Var2,0.75,' 二次 金叉'),coloryellow,ALIGN1;
Var3:=BARSLAST(REF(CROSS(DIF,DEA),1));
Var4:=REF(CLOSE,Var3+1)>CLOSE AND DIF>REF(DIF,Var3+1) AND CROSS(DIF,DEA);
STICKLINE(Var4 ,0 ,0.5 ,6 , 0),ColorFF00FF;
DRAWTEXT(Var4,0.5,' 底部 背离'),ColorFF00FF,ALIGN1;