MACD精简信号指标 通达信公式(附图)

[复制链接]
查看115 | 回复0 | 2021-8-20 16:18:18 | 显示全部楼层 |阅读模式

D1:=12;
D2:=26;
D3:=9;
DIF:EMA(CLOSE,D1)-EMA(CLOSE,D2);
DEA:EMA(DIF,D3);
MACD:2*(DIF-DEA), COLORSTICK,LINETHICK2;
低位金叉:=CROSS(DIF,DEA) AND DIF<-0.1;
STICKLINE(低位金叉,0,0.12,4,0),COLORYELLOW;
DRAWTEXT(低位金叉,0.1,' 低位金叉'),COLORWHITE;
JCCOUNT:=COUNT(CROSS(DIF,DEA),BARSLAST(DEA>=0));
二次金叉:=CROSS(DIF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,30)=1;
STICKLINE(二次金叉,0,0.06,4,0),COLORFF00FF;
DRAWICON(二次金叉,DEA*0.9,1) ;
DRAWTEXT(二次金叉,0.3,' 二次金叉'),COLORYELLOW;
A1:=BARSLAST(REF(CROSS(DIF,DEA),1));
{上一次昨日MACD金叉到当日周期数。}
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF>REF(DIF,A1+1) AND CROSS(DIF,DEA) AND DEA<0;
{上次金叉时的收盘价>当日收盘价,股价创新低,当日MACD金叉点却未创新低,形成底背离 ,并且在0轴之下。}
STICKLINE(底背离,0,0.03,6,0),COLOR00FF00;
底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4;
{第一次金叉为起点,出现底背离的第二次金叉为终点,画线段。}
DRAWTEXT(底背离,-0.15,' 底背离'),COLORFF00FF;
A2:=BARSLAST(REF(CROSS(DEA,DIF),1));
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF,A2+1)>DIF AND CROSS(DEA,DIF);
DRAWTEXT(顶背离,0.3,' 顶背离'),COLORGREEN;
顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4;

14T63H40150-243L.jpg

14T63H40150-243L.jpg

 

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则