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

    正文概述    2024-05-04 04:17:12  
    SHORT:=12;LONG:=26;MID:=9; A:=SUM(C*IF(MOD(DATETODAY(DATE),7)=0,1,0),3)*IF(PERIOD=5,1,0); DF:=SUM(C*IF(MOD(MINUTE,5)=0,1,0),5)*IF(PERIOD=0,1,0) +SUM(C*IF(MOD(MINUTE+55,30)=0,1,0),6)*IF(PERIOD=1,1,0) +SUM(C*IF(HOUR-15=0,1,0),8)*IF(PERIOD=3,1,0) +A+IF(A=0,REF(A,1),0) +IF(REF(A,1)+A=0,REF(A,2),0) +IF(REF(A,2)+REF(A,1)+A=0,REF(A,3),0) +IF(REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,4),0) +IF(REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,5),0) +IF(REF(A,5)+REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,6),0); XX:=1+4*IF(PERIOD=0,1,0) +5*IF(PERIOD=1,1,0) +7*IF(PERIOD=3,1,0) +4*IF(PERIOD=5,1,0); PDIF:EMA(DF,SHORT*XX)-EMA(DF,LONG*XX); PDEA:EMA(PDIF,MID*XX); PMACD:(PDIF-PDEA)*2,COLORSTICK; CROSS(PDIF,PDEA); LOWV:=Ema(LLV(LOW,34),3); HIGHV:=EMA(HHV(HIGH,34),3); RSV:=EMA((CLOSE-LOWV)/(HIGHV-LOWV)*100,3); K:=SMA(RSV,8,1); D:=SMA(K,6,1); J:3*K-2*D,COLORFF00FF; J1:MA(J,3); A1:=BArslAst(REF(crOSS(J,J1),1)); 底背离:=REF(CLOSE,A1+1) CLOSEANDJ REF(J,A1+1)ANDCROSS(J,J1)ANDJ STICKLINE(底背离,0,25,4,0),COLORFF00FF; DRAWTEXT(底背离 0,30,'底背离'),COLORFFFFFF; A2:=BARSLAST(REF(CROSS(J1,J),1)); 顶背离:=REF(CLOSE,A2+1) CLOSEANDREF(J1,A2+1) J1ANDCROSS(J1,J)ANDJ DRAWTEXT(顶背离 0,75,'顶背离'),COLORGREEN; STICKLINE(顶背离,100,80,4,0),COLOR00FF00; 100;



    [源码注释]通达信真正的MACD背离指标公式公式解读


       SHORT:=12;LONG:=26;MID:=9;

       A:=SUM(C*IF(MOD(DATETODAY(DATE),7)=0,1,0),3)*IF(PERIOD=5,1,0);

       DF:=SUM(C*IF(MOD(MINUTE,5)=0,1,0),5)*IF(PERIOD=0,1,0)

       +SUM(C*IF(MOD(MINUTE+55,30)=0,1,0),6)*IF(PERIOD=1,1,0)

       +SUM(C*IF(HOUR-15=0,1,0),8)*IF(PERIOD=3,1,0)

       +A+IF(A=0,REF(A,1),0)

       +IF(REF(A,1)+A=0,REF(A,2),0)

       +IF(REF(A,2)+REF(A,1)+A=0,REF(A,3),0)

       +IF(REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,4),0)

       +IF(REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,5),0)

       +IF(REF(A,5)+REF(A,4)+REF(A,3)+REF(A,2)+REF(A,1)+A=0,REF(A,6),0);

       XX:=1+4*IF(PERIOD=0,1,0)

       +5*IF(PERIOD=1,1,0)

       +7*IF(PERIOD=3,1,0)

       +4*IF(PERIOD=5,1,0);

       PDIF:EMA(DF,SHORT*XX)-EMA(DF,LONG*XX);

       PDEA:EMA(PDIF,MID*XX);

       PMACD:(PDIF-PDEA)*2,COLORSTICK;

       CROSS(PDIF,PDEA);

       LOWV:=Ema(LLV(LOW,34),3);

       HIGHV:=EMA(HHV(HIGH,34),3);

       RSV:=EMA((CLOSE-LOWV)/(HIGHV-LOWV)*100,3);

       K:=SMA(RSV,8,1);

       D:=SMA(K,6,1);

       J:3*K-2*D,COLORFF00FF;

       J1:MA(J,3);

       A1:=BArslAst(REF(crOSS(J,J1),1));

       底背离:=REF(CLOSE,A1+1) CLOSEANDJ REF(J,A1+1)ANDCROSS(J,J1)ANDJ

       STICKLINE(底背离,0,25,4,0),COLORFF00FF;

       DRAWTEXT(底背离 0,30,'底背离'),COLORFFFFFF;

       A2:=BARSLAST(REF(CROSS(J1,J),1));

       顶背离:=REF(CLOSE,A2+1) CLOSEANDREF(J1,A2+1) J1ANDCROSS(J1,J)ANDJ

       DRAWTEXT(顶背离 0,75,'顶背离'),COLORGREEN;

       STICKLINE(顶背离,100,80,4,0),COLOR00FF00;

       100;

       50;

       0;


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