以下是通达信MACD背离公式(无源码的请下载附件导入)
想做个提示MACD背离的指标 研究好久 还是没有达到想要的效果 求高手赐教 不胜感激 目标:当股价创新高而DIF没有创新高时提示有背离可能 DIF也创新高时提示消失
DIFF:EMA(CLOSE,12)-EMA(CLOSE,26);
DEA:EMA(DIFF,9);
MACD:2*(DIFF-DEA), COLORSTICK,LINETHICK2;
金叉:=CROSS(DIFF,DEA);
死叉:=CROSS(DEA,DIFF);
KH:=REF(HHV(H,金叉),死叉);
KL:=REF(LLV(L,死叉),金叉);
MH:=REF(HHV(DIFF,金叉),死叉);
ML:=REF(LLV(DIFF,死叉),金叉);
A1:=BARSLAST(REF(金叉,1));
A2:=BARSLAST(REF(死叉,1));
顶背离:=C>KH AND DIFF<MH AND DIFF>DEA;
底背离:=C<KL AND DIFF>ML AND DIFF<DEA;
A3:=IF(顶背离,1,0);
A8:=IF(DIFF>DEA,1,0);
DRAWTEXT(FILTER(底背离,A2),DIFF,'←底背离'),COLORRED;
DRAWTEXT(FILTER(顶背离,A1),DIFF,'←顶背离'),COLORGREEN;
731322149.jpg
|