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

    正文概述    2024-04-13 15:25:32  

    {标准公式}
    {DIF:EMA(CLOSE,12)-EMA(CLOSE,26);
    DEA:EMA(DIF,9);
    macd:(DIF-DEA)*2,COLORSTICK;}
    {MacD调整参数}
    {DIFF:EMA(CLOSE,7)-EMA(CLOSE,19),COLORWHITE;}
    DIFF:EMA(CLOSE,12)-EMA(CLOSE,26),COLORWHITE;
    DEA:EMA(DIFF,9),COLORYELLOW;
    MACD:(DIFF-DEA)*2,COLORSTICK;
    {牛眼}
    MA1:=MA(C,5);
    MA2:=MA(C,10);
    MA3:=MA(C,20);
    MA6:=MA(C,30);
    MA4:=MA(C,40);
    MA5:=MA(C,60);
    牛眼:(MA1>REF(MA1,1) AND C>MA2 AND C>MA5 AND MA1>MA5 AND MA2>MA5
    AND crOSS(MA1,MA2) AND DIFF>REF(DIFF,1) AND MA5>REF(MA5,1) AND MA4>REF(MA4,1)
    AND MA5>REF(MA5,2) AND V>REF(V,1)*1.6),NODRAW,COLORYELLOW;
    {JCCOUNT:=COUNT(CROSS(DIFF,DEA),BArslAST(DEA>=0));
    牛眼:=CROSS(DIFF,DEA) AND DEA<0 AND V>REF(V,1)*2) AND COUNT(JCCOUNT=N,22)=1;}
    {画图标}
    DRAWICON(牛眼,-0.01,38);
    DRAWTEXT(牛眼,-0.02,'牛眼'),COLORYELLOW;
    A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
    B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1) A2:=BARSLAST(REF(CROSS("kdj.K"(9,3,3),"kdJ.D"(9,3,3)),1));
    B2:=REF(C,A2+1)>C AND REF("KDJ.K"(9,3,3),A2+1)<"KDJ.K"(9,3,3) AND CROSS
    ("KDJ.K"(9,3,3),"KDJ.D"(9,3,3));
    A3:=BARSLAST(REF(CROSS("rsi.RSI1"(6,12,24),"RSI.RSI2"(6,12,24)),1));
    B3:=REF(C,A3+1)>C AND REF("RSI.RSI1"(6,12,24),A3+1)<"RSI.RSI1"(6,12,24) AND
    CROSS("RSI.RSI1"(6,12,24),"RSI.RSI2"(6,12,24));
    C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
    D1:=REF(C,C1+1)DIFF AND CROSS(DEA,DIFF);
    C2:=BARSLAST(REF(CROSS("KDJ.D"(9,3,3),"KDJ.K"(9,3,3)),1));
    D2:=REF(C,C2+1)"KDJ.K"(9,3,3) AND CROSS
    ("KDJ.D"(9,3,3),"KDJ.K"(9,3,3));
    C3:=BARSLAST(REF(CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24)),1));
    D3:=REF(C,C3+1)"RSI.RSI1"(6,12,24) AND
    CROSS("RSI.RSI2"(6,12,24),"RSI.RSI1"(6,12,24));
    {指标底背标示}
    {MACD底背:IF(B1>0,-0.1,0),COLORRED,POINTDOT;}
    KDJ底背:IF(B2>0,-0.1,0),COLORFF00FF,POINTDOT;
    RSI底背:IF(B3>0,-0.1,0),COLORYELLOW,POINTDOT;
    {STICKLINE(B1>0,-0.1,0,2,0),COLORRED;}
    STICKLINE(B2>0,-0.1,0,1,0),COLORFF00FF;
    STICKLINE(B3>0,-0.1,0,1,0),COLORYELLOW;
    {指标顶背标示}
    {MACD顶背:IF(D1>0,0.1,0),COLOR00FF00,POINTDOT;}
    KDJ顶背:IF(D2>0,0.1,0),COLORFFCC66,POINTDOT;
    RSI顶背:IF(D3>0,0.1,0),COLORWHITE,POINTDOT;
    {STICKLINE(D1>0,0.1,0,2,0),COLOR00FF00;}
    STICKLINE(D2>0,0.1,0,1,0),COLORFFCC66;
    STICKLINE(D3>0,0.1,0,1,0),COLORWHITE;
    {画图标}
    {DRAWICON(D2>0,0,2);
    DRAWICON(D3>0,0,2);}
    {画变色线}
    {STICKLINE(MACD>REF(MACD,1) AND MACD>0,0,MACD,0,0),COLORRED;
    STICKLINE(MACD<=REF(MACD,1) AND MACD>0,0,MACD,0,0),COLORYELLOW;
    STICKLINE(MACD STICKLINE(MACD>=REF(MACD,1) AND MACD<0,0,MACD,0,0),COLORMAGENTA;
    STICKLINE(C>0,0,0,50,1),COLORBLUE;
    NOTEXT强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED;
    NOTEXT弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA;}
    {VARA1:=(Dvol/C)/2,NODRAW;
    VARA2:=SUM(IF(VARA1>100 AND CLOSE>REF(CLOSE,1),VARA1,0),0);
    VARA3:=SUM(IF(VARA1>100 AND CLOSE VARA4:=SUM(IF(VARA1<100 AND CLOSE>REF(CLOSE,1),VARA1,0),0);
    VARA5:=SUM(IF(VARA1<100 AND CLOSE VARA6:=VARA2+VARA3+VARA4+VARA5;
    机买:=(VARA2/VARA6)*100,LINETHICK2,COLORRED;
    机卖:=(VARA3/VARA6)*100,LINETHICK2,COLORGREEN;
    主力差:=机买-机卖,LINETHICK2,NODRAW;
    强度:主力差-REF(主力差,1),NODRAW,COLORYELLOW;
    STICKLINE(强度>1.5,-0.1,0,2,0),COLORYELLOW;
    近期:BARSLAST(强度>1.5),NODRAW,COLORGRAY;}
    低位金叉:=CROSS(DIFF,DEA) AND DIFF<-0.1;
    {STICKLINE(低位金叉,0,-0.18,2,0),COLORYELLOW;}
    {DRAWTEXT(低位金叉,DEA-0.02,' 低位金叉'),COLORYELLOW;}
    JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA>=0));
    二次金叉:=CROSS(DIFF,DEA) AND DEA<0 AND COUNT(JCCOUNT=2,21)=1;
    {STICKLINE(二次金叉,0,-0.18,2,0),COLORFF00FF;}
    {DRAWICON(二次金叉,DEA*0.02,13); }
    DRAWTEXT(二次金叉,DEA-0.03,' 二次金叉'),COLORWHITE;
    {自动画线}
    AB1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
    底背离:=REF(CLOSE,AB1+1)>CLOSE AND DIFF>REF(DIFF,AB1+1) AND CROSS(DIFF,DEA);
    {STICKLINE(底背离,0,0.13,2,0),COLOR00FF00;}
    DRAWLINE(AB1=0,DEA,底背离,DEA,0),COLORRED,DOTLINE,LINETHICK1;
    DRAWTEXT(底背离,DEA+0.05,' 底背离'),COLORRED;
    AB2:=BARSLAST(REF(CROSS(DEA,DIFF),1));
    顶背离:=REF(CLOSE,AB2+1)DIFF AND CROSS(DEA,DIFF);
    DRAWLINE(AB2=0,DEA,顶背离,DEA,0),COLORGREEN,DOTLINE,LINETHICK1;
    DRAWTEXT(顶背离,DEA-0.02,' 顶背离'),COLORLIGREEN;
    {N:=7{2,100}
    {M:=5{2,100}
    {VAR1:=(CLOSE-LLV(LOW,60))/(HHV(HIGH,60)-LLV(LOW,60))*80;
    B:=SMA(VAR1,N,1);
    VAR2:=SMA(B,M,1);
    短买:CROSS(B,VAR2) AND B<40,NODRAW,COLORRED;
    DRAWICON(短买,0,11);};
    {高送转提示}
    DRAWTEXT_FIX(1,0.00,0,0,'送转分红:'),COLORGRAY;
    DRAWTEXT_FIX(1,0.10,0,0,EXTERNSTR(0,11)),COLORLIGRAY;
    N:=BARSLAST(CROSS(DEA,0));
    VAR1:=LLV(DEA,N-2)>0 AND SUM(IF(REF(CROSS(DEA,DIFF),1),1,0),N)=0 AND CROSS
    (DEA,DIFF);
    N1:=BARSLAST(VAR1);
    VAR2:=LLV(DEA,N-2)>0 AND SUM(IF(REF(CROSS(DEA,DIFF),1),1,0),N)=1 AND CROSS
    (DEA,DIFF);
    N2:=BARSLAST(VAR2);
    减持:=VAR2 AND REF(DEA,N2+1)>REF(DEA,N1+1);
    大减:=VAR2 AND REF(DEA,N2+1) 清仓:=VAR2 AND REF(DEA,N2+1)REF(C,N1+1);
    BB1:=减持 OR 大减 OR 清仓;
    DRAWTEXT(减持,DEA+0.02,'减持'),COLORGREEN;
    DRAWTEXT(大减,DEA+0.02,'大减'),COLORCYAN;
    DRAWTEXT(清仓,DEA+0.02,'清仓');
    小N:BARSLAST(BB1),NODRAW;
    YQXC:=SUM(IF(CROSS(0,DEA),1,0),小N)=1;
    NN:BARSLAST(CROSS(0,DEA)),NODRAW;
    VARB1:=HHV(DEA,NN-2)<0 AND SUM(IF(REF(CROSS(DIFF,DEA),1),1,0),NN)=0 AND CROSS
    (DIFF,DEA);
    NN1:BARSLAST(VARB1),NODRAW;
    VARB2:=HHV(DEA,NN-2)<0 AND SUM(IF(REF(CROSS(DIFF,DEA),1),1,0),NN)=1 AND CROSS
    (DIFF,DEA);
    NN2:BARSLAST(VARB2),NODRAW;
    增持:=VARB1 AND YQXC=1;
    全仓:=VARB2 AND REF(DEA,NN2+1)>REF(DEA,NN1+1) AND YQXC=1;
    开仓:=IF(全仓,0,VARB2 AND REF(DEA,NN2+1)>REF(DEA,NN1+1));
    DRAWTEXT(增持,DEA-0.05,'增持'),COLORRED;
    DRAWTEXT(全仓,DEA-0.05,'全仓'),COLORMAGENTA;
    DRAWTEXT(开仓,DEA-0.05,'开仓'),COLORYELLOW;


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