最新公告
  • 欢迎您光临九毛八公式指标网www.9m8.cn,本站全新改版试运行,期间内容全部免费,欢迎下载!欢迎加入本站VIP
  • 通达信MACD脉冲指标公式

    正文概述    2024-05-04 04:15:47  
    DIF:=EMA(CLOSE,12)-EMA(CLOSE,26);DEA:=EMA(DIF,9);:CROSS(DIF,0)ORCROSS(DEA,0); input:short(5,1,20),long(26,1,60),M(9,1,30); DIFF:EMA(CLOSE,short)-EMA(CLOSE,long),color0066ff,LINETHICK0,LAYER0; partline(DIFF,DIFF =ref(DIFF,1),rgb(255,0,0),DIFF ref(DIFF,1),rgb(0,255,0)),linethick1; DEA:EMA(DIFF,M),COLOR00BB00,LINETHICK1,LAYER0; MACD:(DIFF-DEA)*2,COLORSTICK; partline(DIFF,DIFF =ref(DIFF,1),rgb(255,0,0),DIFF ref(DIFF,1),rgb(0,255,0)),linethick2; FILLRGN(DIFF,DEA,DIFF DEA,rgb(255,0,0),DIFF DEA,rgb(0,255,0)),linethick2; 中轴:0,LAYER0,Coloreeeeee,LINETHICK1; TYP:=(HIGH+LOW+CLOSE)/3;:(TYP-ma(TYP,14))/(0.015*AVEDEV(TYP,14))*0.0015,COLORCYAN,LINETHICK1;difF:ema(CLOSE,12)-EMA(CLOSE,27)COLORRED;DEA:EMA(DIFF,9),COLORBLUE;macd:2*(DIFF-DEA)COLORSTICK;JCCOUNT:=COUNT(crOSS(DIFF,DEA),BArslAST(DEA =0));一次金:=CROSS(DIFF,DEA)ANDDEA 0ANDCOUNT(JCCOUNT=1,5)=1;二次金:=CROSS(DIFF,DEA)ANDDEA 0ANDCOUNT(JCCOUNT=2,5)=1;三次金:=CROSS(DIFF,DEA)ANDDEA 0ANDCOUNT(JCCOUNT=3,5)=1;四次金:=CROSS(DIFF,DEA)ANDDEA 0ANDCOUNT(JCCOUNT=4,5)=1;一次:IF(一次金,0.3,0)COLORBLUE,LINETHICK2;二次金叉:IF(二次金,0.3,0)COLORLIMAGENTA,LINETHICK2;三次金叉:IF(三次金,0.3,0)COLORMAGENTA,LINETHICK2;四次金叉:IF(四次金,0.3,0)COLORWHITE,LINETHICK2; jcsc:=(M-1)/(M+1)*dea/(1-2/(m+1));{计算出金叉死叉时的Diff值} dd:=(macd/2+(dea*(m-1)/(M+1)))/(1-2/(m+1));{计算出明日macd=macd时的Diff值} xx:=(diff*(short+1)*(long+1)-(long+1)*(short-1)*ema(c,short)+(short+1)*(long-1)*ema(c,long))/(2*((long+1)-(short+1)));{计算今日Diff=diff的对应股价} js:=(jcsc*(short+1)*(long+1)-(long+1)*(short-1)*ema(c,short)+(short+1)*(long-1)*ema(c,long))/(2*((long+1)-(short+1)));{计算金叉死叉的对应股价} ddd:=(dd*(short+1)*(long+1)-(long+1)*(short-1)*ema(c,short)+(short+1)*(long-1)*ema(c,long))/(2*((long+1)-(short+1)));{计算macd柱体变向时的对应股价}; DRAWTEXTABS(3,0,'DIFF拐头股价:'+numtostrn(xx,2)),ColorFFFFFF,LINETHICK3; DRAWTEXTABS(175,0,'MACD柱体变向对应股价:'+numtostrn(ddd,2)),Color00A5FF,LINETHICK3; DRAWTEXTABS(410,0,'金叉死叉对应股价:'+numtostrn(js,2)),COLOR00BB00,LINETHICK3; PARTLINE(DIFF,CROSS(DIFF,DEA)ANDDIFF -0.2,RGB(255,245,12)),CROSSDOT,LINETHICK5; PARTLINE(DIFF,CROSS(DIFF,DEA)ANDDIFF 0,RGB(252,24,212)),CROSSDOT,LINETHICK5; PARTLINE(DIFF,CROSS(DIFF,DEA)ANDDIFF -0.2ANDDIFF 0,RGB(200,80,20)),CROSSDOT,LINETHICK7; PARTLINE(DIFF,CROSS(DEA,DIFF)ANDDIFF 0,RGB(125,245,252)),CIRCLEDOT,LINETHICK5;




    通达信MACD脉冲指标公式源码解读



    DIF赋值:收盘价的12日指数移动平均-收盘价的26日指数移动平均 DEA赋值:DIF的9日指数移动平均 输出选股:DIF上穿0ORCROSS(DEA,0) 输出INPUT:SHORT(5,1,20),LONG(26,1,60),M(9,1,30) 输出DIFF:收盘价的SHORT日指数移动平均-收盘价的LONG日指数移动平均,COLOR0066FF,线宽为0,LAYER0 PARTLINE(DIFF,DIFF =1日前的DIFF,自定色,DIFF 1日前的DIFF,自定色),线宽为1 输出DEA:DIFF的M日指数移动平均,COLOR00BB00,线宽为1,LAYER0 输出平滑异同平:(DIFF-DEA)*2,COLORSTICK PARTLINE(DIFF,DIFF =1日前的DIFF,自定色,DIFF 1日前的DIFF,自定色),线宽为2 FILLRGN(DIFF,DEA,DIFF DEA,自定色,DIFF DEA,自定色),线宽为2 输出中轴:0,LAYER0,COLOREEEEEE,线宽为1 TYP赋值:(最高价+最低价+收盘价)/3 输出CCI:(TYP-TYP的14日简单移动平均)/(0.015*TYP的14日平均绝对偏差)*0.0015,画青色,线宽为1 输出DIFF:收盘价的12日指数移动平均-收盘价的27日指数移动平均画红色 输出DEA:DIFF的9日指数移动平均,画蓝色 输出MACD:2*(DIFF-DEA)COLORSTICK JCCOUNT赋值:统计上次DEA 距今天数日中满足DIFF上穿DEA的天数 =0)) 一次金赋值:DIFF上穿DEAANDDEA 0ANDCOUNT(JCCOUNT=1,5)=1 二次金赋值:DIFF上穿DEAANDDEA 0ANDCOUNT(JCCOUNT=2,5)=1 三次金赋值:DIFF上穿DEAANDDEA 0ANDCOUNT(JCCOUNT=3,5)=1 四次金赋值:DIFF上穿DEAANDDEA 0ANDCOUNT(JCCOUNT=4,5)=1 输出一次金叉:如果一次金,返回0.3,否则返回0画蓝色,线宽为2 输出二次金叉:如果二次金,返回0.3,否则返回0画淡洋红色,线宽为2 输出三次金叉:如果三次金,返回0.3,否则返回0画洋红色,线宽为2 输出四次金叉:如果四次金,返回0.3,否则返回0画白色,线宽为2 JCSC赋值:(M-1)/(M+1)*DEA/(1-2/(M+1)) DD赋值:(MACD/2+(DEA*(M-1)/(M+1)))/(1-2/(M+1)) XX赋值:(DIFF*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*收盘价的SHORT日指数移动平均+(SHORT+1)*(LONG-1)*收盘价的LONG日指数移动平均)/(2*((LONG+1)-(SHORT+1))) 106S赋值:(JCSC*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*收盘价的SHORT日指数移动平均+(SHORT+1)*(LONG-1)*收盘价的LONG日指数移动平均)/(2*((LONG+1)-(SHORT+1))) DDD赋值:(DD*(SHORT+1)*(LONG+1)-(LONG+1)*(SHORT-1)*收盘价的SHORT日指数移动平均+(SHORT+1)*(LONG-1)*收盘价的LONG日指数移动平均)/(2*((LONG+1)-(SHORT+1))) DRAWTEXTABS(3,0,'DIFF拐头股价:'+NUMTOSTRN(XX,2)),COLORFFFFFF,线宽为3 DRAWTEXTABS(175,0,'MACD柱体变向对应股价:'+NUMTOSTRN(DDD,2)),COLOR00A5FF,线宽为3 DRAWTEXTABS(410,0,'金叉死叉对应股价:'+NUMTOSTRN(加速线,2)),COLOR00BB00,线宽为3 PARTLINE(DIFF,DIFF上穿DEAANDDIFF -0.2,自定色),CROSSDOT,线宽为5 PARTLINE(DIFF,DIFF上穿DEAANDDIFF 0,自定色),CROSSDOT,线宽为5 PARTLINE(DIFF,DIFF上穿DEAANDDIFF -0.2ANDDIFF 0,自定色),CROSSDOT,线宽为7 PARTLINE(DIFF,DEA上穿DIFFANDDIFF 0,自定色),CIRCLEDOT,线宽为5



    九毛八公式指标,一个优质的公式指标平台!
    九毛八公式指标 » 通达信MACD脉冲指标公式 加入收藏