通达信实战型MACD指标公式

 

SHORT:=12;
LONG:=26;
MID:=9;
DIFF:EMA(C,SHORT)-EMA(C,LONG);
DEA:EMA(DIFF,MID);
macd:(DIFF-DEA)*2,COLORFFFF00,COLORSTICK;
A1:=BArslAST(REF(crOSS(0, DEA),1));
A2:= BARSLAST(REF(COUNT(DEA<=0,A1+1)=A1+1 AND LLV(DIFF,5)=LLV(DIFF,A1+1) AND CROSS(DIFF,DEA),1));
A3:= BARSLAST(REF(CROSS(DIFF,DEA),1));
DIBL1:=LLV(C,A3+1)=LLV(C,A1+1) AND NOT(LLV(DIFF,A3+1)=LLV(DIFF,A1+1)) AND COUNT(DEA<=0,A2+1)=A2+1 AND CROSS(DIFF,DEA);
金叉:IF(CROSS(DIFF,DEA) AND DEA<=0 AND DIBL1=0,0,DEA),COLORYELLOW;
底背离:IF(DIBL1,0,DEA),COLORRED;
B1:=BARSLAST(REF(CROSS(DEA,0),1));
B2:=BARSLAST(REF(COUNT(DEA>=0,B1+1)=B1+1 AND HHV(DIFF,5)=HHV(DIFF,A1+1) AND CROSS(DEA,DIFF),1));
B3:=BARSLAST(REF(CROSS(DEA,DIFF),1));
DINGBL1:= HHV(C,B3+1)=HHV(C,B1+1) AND NOT(HHV(DIFF,B3+1)=HHV(DIFF,B1+1)) AND COUNT(DEA>=0,B2+1)=B2+1 AND CROSS(DEA,DIFF);
死叉:IF(CROSS(DEA,DIFF) AND DEA>=0 AND DINGBL1=0,0,DEA),COLORFFFF00;
顶背离:IF(DINGBL1,0,DEA),COLORGREEN;
DIBJG:=LLV(C,A3+1)=LLV(C,A1+1) AND NOT(LLV(DIFF,A3+1)=LLV(DIFF,A1+1)) AND DIFF>REF(DIFF,1) AND COUNT(DEA<=0,A2+1)=A2+1 AND DIFF<DEA ;
DINGBJG:=HHV(C,B3+1)=HHV(C,B1+1) AND NOT(HHV(DIFF,B3+1)=HHV(DIFF,B1+1)) AND REF(DIFF,1)>DIFF AND COUNT(DEA>=0,B2+1)=B2+1 AND DIFF>DEA ;
STICKLINE(DIBJG =1 ,DEA,DIFF,2,0),COLORRED;
STICKLINE(DINGBJG =1 ,DEA,DIFF,2,0),COLORGREEN;
MB:=EMA(DIFF,20);
UB:=MB+1.9104*STD(DIFF,20);
LB:=MB-1.9104*STD(DIFF,20);
ZJS:=HHV(DEA,B1+1)/2;
ZJX:=LLV(DEA,A1+1)/2;
STICKLINE(DEA>DIFF AND DEA>0 AND DEA>ZJS, ZJS,REF(ZJS,1),1,0), COLORRED;
STICKLINE(DEA<DIFF AND DEA<0 AND DEA<ZJX,ZJX, REF(ZJX,1),1,0),COLORGREEN;




来函数检测结果如下
该公式没有未来函数


解密、定制、编写公式指标请联系QQ或微信同号:88652583
置顶指标

相关指标公式

SHORT赋值:12
LONG赋值:26
MID赋值:9
输出DIFF:收盘价的SHORT日指数移动平均-收盘价的LONG日指数移动平均
输出DEA:DIFF的MID日指数移动平均
输出平滑异同平均线:(DIFF-DEA)*2,COLORFFFF00,COLORSTICK
A1赋值:上次1日前的0上穿DEA距今天数
A2赋值: 上次1日前的统计A1+1日中满足DEA<=0的天数=A1+1ANDLLV(DIFF,5)=A1+1日内DIFF的最低值ANDCROSS(DIFF,DEA)距今天数
A3赋值: 上次1日前的DIFF上穿DEA距今天数
DIBL1赋值:A3+1日内收盘价的最低值=A1+1日内收盘价的最低值 AND 取反 AND 统计A2+1日中满足DEA<=0的天数=A2+1 AND DIFF上穿DEA
输出金叉:如果DIFF上穿DEAANDDEA<=0ANDDIBL1=0,返回0,否则返回DEA,画黄色
输出底背离:如果DIBL1,返回0,否则返回DEA,画红色
B1赋值:上次1日前的DEA上穿0距今天数
B2赋值:上次1日前的统计B1+1日中满足DEA>=0的天数=B1+1ANDHHV(DIFF,5)=A1+1日内DIFF的最高值ANDCROSS(DEA,DIFF)距今天数
B3赋值:上次1日前的DEA上穿DIFF距今天数
DINGBL1赋值: B3+1日内收盘价的最高值=B1+1日内收盘价的最高值 AND 取反 AND 统计B2+1日中满足DEA>=0的天数=B2+1 AND DEA上穿DIFF
输出 死叉:如果DEA上穿DIFFANDDEA>=0ANDDINGBL1=0,返回0,否则返回DEA,COLORFFFF00
输出顶背离:如果DINGBL1,返回0,否则返回DEA,画绿色
DIBJG赋值:A3+1日内收盘价的最低值=A1+1日内收盘价的最低值 AND 取反 AND DIFF>1日前的DIFF AND 统计A2+1日中满足DEA<=0的天数=A2+1 AND DIFFDINGBJG赋值:B3+1日内收盘价的最高值=B1+1日内收盘价的最高值 AND 取反 AND 1日前的DIFF>DIFF AND 统计B2+1日中满足DEA>=0的天数=B2+1 AND DIFF>DEA
当满足条件DIBJG=1时,在DEA和DIFF位置之间画柱状线,宽度为2,0不为0则画空心柱.,画红色
当满足条件DINGBJG=1时,在DEA和DIFF位置之间画柱状线,宽度为2,0不为0则画空心柱.,画绿色
MB赋值:DIFF的20日指数移动平均
UB赋值:MB+1.9104*DIFF的20日估算标准差
LB赋值:MB-1.9104*DIFF的20日估算标准差
ZJS赋值:B1+1日内DEA的最高值/2
ZJX赋值:A1+1日内DEA的最低值/2
当满足条件DEA>DIFFANDDEA>0ANDDEA>ZJS时,在ZJS和1日前的ZJS位置之间画柱状线,宽度为1,0不为0则画空心柱., 画红色
当满足条件DEA

指标安装下载帮助  |   联系我们  |  股朋指标网  |  指标网   |  指标公式  |   加入收藏   |  设为主页

@2005-2023 粤ICP备2023063687号-2 股朋指标网别名指标网均来源互联网收集整理,如不慎侵犯了你的权益,请联系我们告知,我们将做删除处理
免责声明:股朋指标网所有指标公式及文章由网络收集,不保障实时性和真实性, 仅供学习研究并不构成投资建议,请勿以此为依据进行股票交易,由此引起的投资亏损与本站无关。
QQ:88652583 微信 88652583
sitemap站点地图