{MACD顶底背离}
DIF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORWHITE;
DEA:EMA(DIF,9),COLORYELLOW,NODRAW;
MACD:(DIF-DEA)*2,COLORRED,NODRAW;
NOTEXT1:HHV(DIF,34/3),COLORLIMAGENTA,LINETHICK1;
NOTEXT2:LLV(DIF,34/3),COLORGREEN,LINETHICK1;
SE:=DIF NOTEXT1 AND DIF!=NOTEXT2 AND DIF REF(DIF,1);
BU:=DIF NOTEXT2 AND DIF!=NOTEXT1 AND DIF REF(DIF,1);
CB:=DIF=NOTEXT2;
CG:=DIF=NOTEXT1;
S:IF(SE,DYNAINFO(7),DRAWNULL),COLORGREEN,NODRAW;
B:IF(BU,DYNAINFO(7),DRAWNULL),COLORRED,NODRAW;
D:=IF(CB,DYNAINFO(7),DRAWNULL),COLORGREEN,NODRAW;
F:IF(CG,DYNAINFO(7),DRAWNULL),COLOR2693FF,NODRAW;
{MACD二进制计算}
DIFF:=ABS(DIF);
DEAA:=ABS(DEA);
EJZ1:=DIFF-(2*DEAA),NODRAW;
EJZ2:=DEAA-(2*DIFF),NODRAW;
BNS:IF(DIFF DEAA,EJZ1,EJZ2),COLORB18192,NODRAW;
A:=LLV(MACD,50)=MACD;
DRAWICON(A AND FILTERX(A,20), MACD,1);
{MACD背离信号}
HBL:=REF(ZGZ,1)=REF(ZGZ,2);
LBL:=REF(ZDZ,1)=REF(ZDZ,2);
DRAWTEXT(HBL,ZGZ,'-'),COLORBLUE;
DRAWTEXT(LBL,ZDZ,'-'),COLOR0099FF;
STICKLINE(BU,0,0,5,1),COLORMAGENTA;
STICKLINE(CG,0,0,5,1),COLORMAGENTA;
STICKLINE(SE,0,0,5,1),COLORLICYAN;
STICKLINE(CB,0,0,5,1),COLORLICYAN;
{选股公式-------以下是单独的公式!}
DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:=EMA(DIF,9);
MACD:=(DIF-DEA)*2;
NOTEXT1:=HHV(DIF,34/3);
NOTEXT2:=LLV(DIF,34/3);
TJ1:=DIF REF(DIF,1) AND DIF
XG:DIF NOTEXT2 AND DIF!=NOTEXT1 AND TJ1;