SHORT:=12;
LONG:=26;
MID:=9;
DIF:EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:EMA(DIF,MID);
MACD:(DIF-DEA)*2,COLORSTICK;
{底背离}
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA);
NOTEXT底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),DOTLINE,COLORRED;
{顶背离}{股票指标网}
A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND DIF<REF(DIF,A2+1) AND CROSS(DEA,DIF);
NOTEXT顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),DOTLINE,COLORGREEN;
DRAWICON(CROSS(DIF,DEA),DEA*1.08,38);{金叉}
DRAWICON(CROSS(DEA,DIF),DEA*1.08,39);{死叉}
DRAWICON(底背离,DEA*2.0,7);
DRAWICON(顶背离,DEA*2.0,8);
{
选股公式:
SHORT:=12;
LONG:=26;
MID:=9;
去停牌:=DYNAINFO(17)>0;
DIF:=EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);
DEA:=EMA(DIF,MID);
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA);
底背离 AND 去停牌;
}