DIFF:=EMA(DCLOSE,12)-EMA(DCLOSE,26);
DEA:=EMA(DIFF,9),COLORFFFF00;
MACD:=(DIFF-DEA)*2;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
A2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
底背离:REF(CLOSE,A1+3)>CLOSE AND DIFF>REF(DIFF,A1+3) AND CROSS(DIFF,DEA);
顶背离:REF(CLOSE,A2+3)<=CLOSE AND REF(DIFF,A2+3)>DIFF AND CROSS(DEA,DIFF);