通达信简单明了MACD指标公式

通达信突出重围选股指标公式

通达信简单明了MACD指标公式:

DIFF:=(EMA(CLOSE,12) - EMA(CLOSE,26));

DEA:=EMA(DIFF,9);

macd2:=(2 * (DIFF - DEA));

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)) AND (CLOSE > UDGLINE)) AND (TDU0 < TUD0));

JUD0:=(((REF(CLOSE,1) >= REF(UDGLINE,1)) AND (CLOSE < UDGLINE)) AND (TUD0 < TDU0));

JDU1:=(JDU0 AND (COUNT(JDU0,TDU0) = 1));

JUD1:=(JUD0 AND (COUNT(JUD0,TUD0) = 1));

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

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

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

JUD3:=(JUD1 AND (REF(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)))));

DRAWICON((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))),0, 0) ;

DRAWICON((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))),0,0) ;

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

STICKLINE(((MACD2 >= 0) AND (MACD2 < REF(MACD2,1))),0,MACD2,2,0),COLORRED;

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

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

DIF:DIFF,LINETHICK1,COLORYELLOW ;

MACD:DEA ,COLORLIMAGENTA ;

DEF:MACD2,LINETHICK0,COLORFFFF00 ;

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

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) > 0) AND (MACD2 < REF(MACD2,1))) AND (REF(MACD2,1) > REF(MACD2,2))) AND (REF(MACD2,2) > REF(MACD2,3))),MACD2,2) ;

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

DRAWICON(((((JUD1 OR (BARSLAST(JDU1) > BARSLAST(JUD1))) AND (MACD2 >= 0)) AND (REF(MACD2,1) < REF(DEFU2L,1))) AND (MACD2 > DEFU2L)),MACD2,12) ;

DRAWICON(((((JDU1 OR (BARSLAST(JDU1) < BARSLAST(JUD1))) AND (MACD2 < 0)) AND (REF(MACD2,1) > REF(DEFD2L,1))) AND (MACD2 < DEFD2L)),MACD2,12);}

{MACD}

_红柱:=IF("MACD.MACD">REF("MACD.MACD",1),"MACD.MACD",DRAWNULL),STICK,COLORRED;

绿柱:=IF("MACD.MACD"<REF("MACD.MACD",1),"MACD.MACD",DRAWNULL),STICK,COLORYELLOW;

_抄底:=ABS((CROSS("MACD.DIF","MACD.DEA")

&&"MACD.DEA"<=-0.07)*"MACD.DIF")*1.50,COLORLIMAGENTA;

_DIF:="MACD.DIF",COLORWHITE;

_DEA:="MACD.DEA",COLORYELLOW;

__强度:=IF(_DIF>_DEA,_DIF,DRAWNULL),COLORRED,LINETHICK2;

_强度:=IF(_DEA<_DIF,_DEA,DRAWNULL),COLORMAGENTA,LINETHICK2;

DRAWTEXT(ABS(_抄底)>0,_抄底*1.20,' 抄底'),COLORYELLOW;

{DRAWICON(ABS(_抄底)>0,_抄底*1.10,4);}

DRAWICON(CROSS(_DIF,_DEA),_DEA,1);

DRAWICON(CROSS(_DEA,_DIF),_DEA,2);

A111:=BARSLAST(REF(CROSS("MACD.DIF","MACD.DEA"),1));

B1:=REF(C,A111+1)>C AND REF("MACD.DIF",A111+1)<"MACD.DIF" AND CROSS("MACD.DIF","MACD.DEA");

DRAWTEXT(B1>0,_DIF*0.95,'MACD'),COLORRED;{MACD底背离};

C1:=BARSLAST(REF(CROSS("MACD.DEA","MACD.DIF"),1));

D1:=REF(C,C1+1)<C AND REF("MACD.DIF",C1+1)>"MACD.DIF" AND CROSS("MACD.DEA","MACD.DIF");

DRAWTEXT(D1>0,_DEA*1.05,'MACD'),COLORWHITE;{MACD顶背离};

净资产增长率:FINANCE(33)/FINANCE(34),NODRAW;

每股收益:FINANCE(33),NODRAW;

公积金:FINANCE(18),NODRAW;

未分利润:FINANCE(32),NODRAW;

净资产:FINANCE(34),NODRAW;

流通股:FINANCE(7)/100000000,NODRAW;

总股本:FINANCE(1)/100000000,NODRAW;

市净率PB:C/FINANCE(34),NODRAW;

市盈率PE:C/FINANCE(33),NODRAW;

现金流:FINANCE(26)/100000000,NODRAW;

换手率:V*100/CAPITAL,NODRAW;

换手率20:SUM(V*100,20)/CAPITAL,NODRAW;

换手率60:SUM(V*100,60)/CAPITAL,NODRAW;

{现金流:FINANCE(26)/100000000,NODRAW;

营业利润:FINANCE(23)/100000000,NODRAW;

利润总额:FINANCE(28)/100000000,NODRAW;

净资产:FINANCE(34),NODRAW;

流通股:FINANCE(7)/100000000,NODRAW;

总股本:FINANCE(1)/100000000,NODRAW;};

{MACD四线趋势}

{DIFF2:EMA(CLOSE,30)-EMA(CLOSE,60);

DEA2:EMA(DIFF2,15);

MACD3:=3*(DIFF2-DEA2);

{STICKLINE(MACD3<REF(MACD3,1) AND MACD3>0,0,MACD3,1,0),COLORYELLOW;

STICKLINE(MACD3>=REF(MACD3,1)AND MACD3>0,0,MACD3,1,0),COLORRED; }

{STICKLINE(MACD3>REF(MACD3,1)AND MACD3<0,0,MACD3,1,0),COLORFFC8FF;

STICKLINE(MACD3<=REF(MACD3,1)AND MACD3<0,0,MACD3,1,0),COLORFFCC66;}

{DIF3:EMA(CLOSE,9)-EMA(CLOSE,18),LINETHICK2;

DEA3:EMA(DIF3,7),LINETHICK2;}

{下穿:=COUNT(DEA<=0,5)=1 AND DEA<=0;

上穿:=COUNT(DEA>=0,5)=1 AND DEA>=0;

DRAWTEXT(下穿,LOW*0.1,'↓'),COLORYELLOW;

DRAWTEXT(上穿,LOW*0.1,'↑'),COLOR0000FF;

日线空头:IF(DEA<0,1,0);};

通达信绝对底选股指标公式