您现在的位置:程序化交易>> 股票公式>> 通达信>> 通达信知识>>正文内容

四色macd指标源码 [通达信]

  • 咨询内容: 这个指标原来里面有kdj等,都被我去掉了。不过还有别的,我要一个纯粹四色的macd。自己判断是不是背离等等。因为有了其他的指标,造成指标空间压缩的非常窄小,视觉上不方便。恳请高手老师帮忙修改一下。小弟在这里先谢谢了。



    DIFF:EMA(CLOSE,12) - EMA(CLOSE,26);
    DEA:EMA(DIFF,9);
    MACD:2*(DIFF-DEA),COLORSTICK;
    A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
    B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1)C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
    D1:=REF(C,C1+1)DIFF AND CROSS(DEA,DIFF);
    MACD底背:IF(B1>0,-0.1,0),COLORRED,POINTDOT;
    MACD顶背:IF(D1>0,0.1,0),COLOR00FF00,POINTDOT;
    STICKLINE(B1>0,-0.1,0,2,0),COLORRED;
    STICKLINE(D1>0,0.1,0,2,0),COLOR00FF00;
    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(MACDSTICKLINE(MACD>=REF(MACD,1) AND MACD<0,0,MACD,0,0),COLORMAGENTA;
    STICKLINE(C>0,0,0,10,1),COLORBLUE;
    DIFF,COLORGREEN;
    DEA,COLORYELLOW;强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED;
    弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA;

     

  • 通达信技术部: 你的指标竟然有语法错误,以后编程还是认真点,我都改好了,看是不是你要的结果 DIFF:EMA(CLOSE,12) - EMA(CLOSE,26); DEA:EMA(DIFF,9); MACD:2*(DIFF-DEA),COLORSTICK; A1:=BARSLAST(REF(CROSS(DIFF,DEA),1)); B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1); C1:=BARSLAST(REF(CROSS(DEA,DIFF),1)); D1:=REF(C,C1+1) AND CROSS(DEA,DIFF); MACD底背:IF(B1>0,-0.1,0),COLORRED,POINTDOT; MACD顶背:IF(D1>0,0.1,0),COLOR00FF00,POINTDOT; STICKLINE(B1>0,-0.1,0,2,0),COLORRED; STICKLINE(D1>0,0.1,0,2,0),COLOR00FF00; 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>=REF(MACD,1) AND MACD<0,0,MACD,0,0),COLORMAGENTA; STICKLINE(C>0,0,0,10,1),COLORBLUE; DIFF,COLORGREEN; DEA,COLORYELLOW;强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED; 弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA;

     

  • 通达信客服:

    上面那个没有分行,看这个吧

     


    你的指标竟然有语法错误,以后编程还是认真点,我都改好了,看是不是你要的结果


    DIFF:EMA(CLOSE,12) - EMA(CLOSE,26);
    DEA:EMA(DIFF,9);
    MACD:2*(DIFF-DEA),COLORSTICK;
    A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
    B1:=REF(C,A1+1)>C AND REF(DIFF,A1+1);
    C1:=BARSLAST(REF(CROSS(DEA,DIFF),1));
    D1:=REF(C,C1+1) AND CROSS(DEA,DIFF);
    MACD底背:IF(B1>0,-0.1,0),COLORRED,POINTDOT;
    MACD顶背:IF(D1>0,0.1,0),COLOR00FF00,POINTDOT;
    STICKLINE(B1>0,-0.1,0,2,0),COLORRED;
    STICKLINE(D1>0,0.1,0,2,0),COLOR00FF00;
    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>=REF(MACD,1) AND MACD<0,0,MACD,0,0),COLORMAGENTA;
    STICKLINE(C>0,0,0,10,1),COLORBLUE;
    DIFF,COLORGREEN;
    DEA,COLORYELLOW;强:IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED;
    弱:IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA;

     

  • 网友交流: 谢谢老师,我放进软件里了。还有强和弱的提示。还得麻烦您给修改一下,把强和弱都去掉,不要其他提示。要四个颜色的macd就行。有其他的提示把主要指标压缩的失真,看不清了。谢谢!!!(指标不是我编的,我根本不会编,呵呵)

     

  • 网友交流: 强:=IF(DIFF>MA(DIFF,2),DIFF,DRAWNULL),COLORRED; 弱:=IF(DEA>MA(DEA,2),DEA,DRAWNULL),COLORMAGENTA;

 

有思路,想编写各种指标公式,程序化交易模型,选股公式,预警公式的朋友

可联系技术人员 QQ: 262069696  点击在线交流进行 有偿 编写!不贵!点击查看价格!


【字体: 】【打印文章】【查看评论

相关文章

    没有相关内容