以下是通达信MACD底顶背离源码副图(无源码的请下载附件导入)
DIFF:=EMA(CLOSE,12) - EMA(CLOSE,26);
DEA:=EMA(DIFF,9);
MACD:=2*(DIFF-DEA);
QZQ:=BARSLAST(REF(MACD,1)<0 AND MACD>0);
MACD金叉天数:=REF(QZQ,1);
股价新低:=L=LLV(L,QZQ+10);
低7:=COUNT(股价新低,7)>0;
DIFF最低:=LLV(DIFF,QZQ-2)>LLV(DIFF,QZQ+10);
DIF非新低:=REF(DIFF最低,1);
底背离1:=低7 AND DIF非新低 AND CROSS(DIFF,DEA) AND COUNT(CROSS(DEA,DIFF),5)<2,COLORRED;
底背离:IF(底背离1,0.5,0),COLORRED,LINETHICK2;
EJ:=REF(COUNT(底背离1,QZQ+1)=1,1) AND CROSS(DIFF,DEA) AND DIFF<0;
黄金叉:IF(EJ,0.7,0),COLORMAGENTA,LINETHICK2;
QSC:=BARSLAST(REF(MACD,1)>0 AND MACD<0);
MACD死叉天数:=REF(QSC,1);
股价新高:=H=HHV(H,QSC+10);
高7:=COUNT(股价新高,7)>0;
DIFF最高:=HHV(DIFF,QSC-2)<HHV(DIFF,QSC+10);
DIF非新高:=REF(DIFF最高,1);
顶背离1:=高7 AND DIF非新高 AND CROSS(DEA ,DIFF) AND COUNT(CROSS(DIFF,DEA),5)<2,LINESTICK;
顶背离:IF(顶背离1,0.5,0),COLORYELLOW,LINETHICK2;
DRAWTEXT(顶背离1,0.4,'顶背离'),COLORLIBLUE;
DRAWTEXT(底背离1,0.4,'底背离'),COLORMAGENTA;
DRAWTEXT(EJ,0.6,'黄金叉'),COLORMAGENTA;
644388163.jpg
644444737.jpg
|