以下是通达信大机构macd指标公式源码和使用说明

通达信大机构版MACD指标公式源码:

   r:=(ZDMR+BDMR);

   DIFF:EMA(r,5)-EMA(r,60),colorwhite,linethick1;

   DEA:EMA(DIFF,7),coloryellow,linethick1;

   MACD:(DIFF-DEA);//隐藏;

   趋势线:EMA(DEA,15),ColorFF6EC7,linethick1;

   STICKLINE(MACD>0,MACD,0,5,0,0),colorred;

   STICKLINE(MACD<0,MACD,0,5,0,0),colorliblue;

   DRAWICON(CROSS(DIFF,DEA),DEA,1);

   LONG:=26;

   SHORT:=12;

   M:=9;

   DIFF:=EMA(CLOSE,SHORT)-EMA(CLOSE,LONG);

   DEA:=EMA(DIFF,M);

   macd2:=2*(DIFF-DEA);

   (CLOSE<0ANDcrOSS(DIFF,0),H*1.3),COLOR000080,NODRAW;

   (CLOSE<0ANDCROSS(MacD2,0),H*1.3),COLOR000080,NODRAW;

   (CLOSE<0ANDCROSS(0,DIFF),H*1.3),COLOR808080,NODRAW;

   (CLOSE<0ANDCROSS(0,MACD2),H*1.3),COLOR808080,NODRAW;

   DU0:=CROSS(DIFF,0);

   UD0:=CROSS(0,DIFF);

   TDU0:=BArslAST(DU0);

   TUD0:=BARSLAST(UD0);

   DU3:=REF(DU0,1);

   UD3:=REF(UD0,1);

   TDU3:=BARSLAST(DU3);

   TUD3:=BARSLAST(UD3);

   UDGLINE:=IF(TDU3<TUD3,REF(HHV(HIGH,2),TDU3),REF(LLV(LOW,2),TUD3));

   JDU0:=REF(CLOSE,1)<=REF(UDGLINE,1)ANDCLOSE>UDGLINEANDTDU0<TUD0;

   JUD0:=REF(CLOSE,1)>=REF(UDGLINE,1)ANDCLOSE<UDGLINEANDTUD0<TDU0;

   JDU1:=JDU0ANDCOUNT(JDU0,TDU0)=1;

   JUD1:=JUD0ANDCOUNT(JUD0,TUD0)=1;

   JDU2:=JDU1ANDREF(BARSLAST(JUD1),1)<REF(BARSLAST(JDU1),1);

   JUD2:=JUD1ANDREF(BARSLAST(JUD1),1)>REF(BARSLAST(JDU1),1);

   JDU3:=JDU1ANDREF(BARSLAST(JUD1),1)>REF(BARSLAST(JDU1),1);

   JUD3:=JUD1ANDREF(BARSLAST(JUD1),1)<REF(BARSLAST(JDU1),1);

   bsLINE:=IF(BARSLAST(JDU2)<BARSLAST(JUD2),IF(REF(CROSS(0,MACD2),1),LLV(LOW,2),REF(LLV(LOW,2),BARSLAST(REF(CROSS(0,MACD2),1)))),IF(REF(CROSS(MACD2,0),1),HHV(HIGH,2),REF(HHV(HIGH,2),BARSLAST(REF(CROSS(MACD2,0),1)))));

   STICKLINE(MACD2>=0,0,MACD2,2,1),COLOR0000FF;

   STICKLINE(MACD2>=0ANDMACD2<REF(MACD2,1),0,MACD2,2,0),COLOR0000FF;

   STICKLINE(MACD2<0,0,MACD2,2,0),COLORFFFF00;

   STICKLINE(MACD2<0ANDMACD2>REF(MACD2,1),0,MACD2,2,1),COLORFFFF00;

   DIF:DIFF,LINETHICK2,COLOR0000FF;

   MACD:DEA,COLORFF0000;

   DEF:MACD2,LINETHICK0,COLORFFFF00;

   STICKLINE(CLOSE>0,0,0,2,0),COLOR808080;

   DEFUT:=BARSLAST(CROSS(MACD2,0));

   DEFDT:=BARSLAST(CROSS(0,MACD2));

   DEFUL:=IF(MACD2>=0,HHV(MACD2,DEFUT+1),REF(HHV(MACD2,DEFUT+1),DEFDT+1));

   DEFDL:=IF(MACD2<0,LLV(MACD2,DEFDT+1),REF(LLV(MACD2,DEFDT+1),DEFUT+1));

   DEFU2L:=REF(DEFUL,DEFUT+1);

   DEFD2L:=REF(DEFDL,DEFDT+1);

   DRAWICON(LLV(MACD2,4)>0ANDMACD2<REF(MACD2,1)ANDREF(MACD2,1)>REF(MACD2,2)ANDREF(MACD2,2)>REF(MACD2,3),MACD2,2);

   DRAWICON(HHV(MACD2,4)<0ANDMACD2>REF(MACD2,1)ANDREF(MACD2,1)<REF(MACD2,2)ANDREF(MACD2,2)<REF(MACD2,3),MACD2,1);

   DRAWICON((JUD1ORBARSLAST(JDU1)>BARSLAST(JUD1))ANDMACD2>=0ANDREF(MACD2,1)<REF(DEFU2L,1)ANDMACD2>DEFU2L,MACD2,5);

   DRAWICON((JDU1ORBARSLAST(JDU1)<BARSLAST(JUD1))ANDMACD2<0ANDREF(MACD2,1)>REF(DEFD2L,1)ANDMACD2<DEFD2L,MACD2,3);

   VAR111:=JDU1ORBARSLAST(JDU1)<BARSLAST(JUD1);

   VAR112:=HHV(MACD2,4)<0ANDMACD2>REF(MACD2,1)ANDREF(MACD2,1)<REF(MACD2,2)ANDREF(MACD2,2)<REF(MACD2,3);

   A1:=DYNAINFO(6);

   A22:=IF((LOW>A1),0,IF((HIGH<A1),1,(((A1-LOW)+0.01)/((HIGH-LOW)+0.01))));

   A3:=(VOL/WINNER(LOW));

   A4:=REF(HHV(CLOSE,120),1);

   A5:=REF(LLV(CLOSE,120),1);

   A6:=((100*(CLOSE-A5))/(A4-A5));

   A7:=((A22>0)OR(A22=1));

   A8:=((A7AND((A3/REF(A3,3))>=3))AND(A6<80));

   A9:=(((REF(A8,1)ORREF(A8,2))ORREF(A8,3))ORREF(A8,4));

   A10:=(A8ANDA9);

   进场:IF(FILTER(A8,3),5,0);

通达信大机构版MACD指标公式截图

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。