DIFF:=EMA(DCLOSE,12)-EMA(DCLOSE,26);

DEAA:=EMA(DIFF,9),COLORFFFF00;

MACD1:=(DIFF-DEAA)*2;

A61:=BARSLAST(REF(CROSS(DIFF,DEAA),1));

A62:=BARSLAST(REF(CROSS(DEAA,DIFF),1));

底背离:=REF(CLOSE,A61+1)>CLOSE AND DIFF>REF(DIFF,A61+1) AND CROSS(DIFF,DEAA)AND TIME>=1450;

顶背离:=REF(CLOSE,A62+1)<CLOSE AND REF(DIFF,A62+1)>DIFF AND CROSS(DEAA,DIFF);

¥④:IF(底背离,999,0),LINETHICK5,COLORMAGENTA;

DRAWTEXT(底背离,500,' MACD底背离'),COLORRED;