当前位置:首页 > 通达信 > 正文

【通达信源码分享】精品指标公式-顶背离MACD指标源码

2022-10-29未知 编 辑:掌上指标


公式源码:
 
DIF1:=EMA(CLOSE,12) - EMA(CLOSE,26);
 
DEA1:=EMA(DIF1,9);
 
MACD1:=2*(DIF1-DEA1),STICK;
 
MACD2:=EMA(MACD1,3);
 
STICKLINE(MACD1>MACD2 AND MACD1>0,0,MACD1,1,0),COLORRED;
 
STICKLINE(MACD1>MACD2 AND MACD1<0,0,MACD1,1,0),COLORGREEN;
 
STICKLINE(MACD1<MACD2,0,MACD1,1,0),COLORCBCBC0;
 
STICKLINE(MACD1>=0 OR MACD1<=0,0,0,50,1),COLORWHITE;
 
DIF:DIF1,COLOR33FF33;
 
DEA:DEA1,COLORYELLOW;
 
MACD:MACD1,NODRAW,COLORMAGENTA;
 
强:IF(DIF1>=DEA1,DIF1,DRAWNULL),COLORRED,LINETHICK2;
 
A1:=BARSLAST(REF(CROSS(DIF1,DEA1),1));
 
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIF1>REF(DIF1,A1+1) AND CROSS(DIF1,DEA1);
 
STICKLINE(底背离,0,0.03,4,0),COLOR00FF00;
 
底背:DRAWLINE(A1=0,DEA1,底背离,DEA1,0),COLORRED,LINETHICK4;
 
A2:=BARSLAST(REF(CROSS(DEA1,DIF1),1));
 
顶背离:=REF(CLOSE,A2+1)<CLOSE AND REF(DIF1,A2+1)>DIF1 AND CROSS(DEA1,DIF1);
 
顶背:DRAWLINE(A2=0,DEA1,顶背离,DEA1,0),COLORGREEN,LINETHICK4; 
 
DRAWICON(CROSS(DIF,DEA),DIF,1); {DIF上穿DEA做记号};
 
DRAWICON(CROSS(DEA,DIF),DEA,2); {DIF下穿DEA做记号}; 
大家都爱看
查看更多热点新闻
点击进入掌上指标资源网-下载各类指标