DIFF:((EMA(CLOSE,12) - EMA(CLOSE,26))),LINETHICK2;
DEA : EMA(DIFF,9);
MACD : 2*(DIFF-DEA), COLORSTICK;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)<DIFF AND CROSS(DIFF,DEA);
C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
D1:=REF(C,C1+1)<C AND REF(DIFF,C1+1)>DIFF AND CROSS(DEA,DIFF);
DRAWTEXT(B1>0,DIFF*1.05,'底背离'),colorred;
STICKLINE(((MACD>REF(MACD,1)) AND (MACD>0)),0,MACD,1,0),colormagenta,LINETHICK4;
STICKLINE(((MACD<REF(MACD,1)) AND (MACD<0)),0,MACD,1,0),colorligreen,LINETHICK4;
DIFF1降:IF(DIFF<REF(DIFF,1),DIFF,DRAWNULL),colorgreen,LINETHICK2;
DEA1降:IF(DEA<REF(DEA,1),DEA,DRAWNULL),colormagenta;