最新公告
  • 欢迎您光临九毛八公式指标网www.9m8.cn,本站全新改版试运行,期间内容全部免费,欢迎下载!欢迎加入本站VIP
  • 改良macd指标公式源码(macd实战指标公式)

    正文概述    2024-05-04 04:02:25  


    通达信指标公式源码概况:


    指标类别: 通达信指标公式


    授权方式: 免费版


    指标评级: ★★★★★


    指标分类: 策略


    画线方法: 副图



    一、改良指标公式源码

     

    /*CA:=MA(CLOSE,5); 

    CJ5:=CA*102/100; 

    HA:=MA(H,5); 

    HJ5:=HA*102/100; 

    TGH1:=IF(C OANDH REF(C,1),ATAN(HJ5-REF(CJ5,1)),0); 

    TGH2:=IF(C OANDH REF(C,1),-ATAN(REF(CJ5,1)-HJ5),0); 

    TGH3:=IF(C OANDH=REF(C,1),0,0); 

    LGH1:=IF(C OANDH REF(C,1),ATAN(HJ5-REF(CJ5,1)),0); 

    LGH2:=IF(C OANDH REF(C,1),-ATAN(REF(CJ5,1)-HJ5),0); 

    LGH3:=IF(C OANDH=REF(C,1),0,0); 

    GGH:=(TGH1+TGH2+TGH3+LGH1+LGH2+LGH3); 

    强弱线:MA(REF(GGH,1),26),LINETHICK2,COLORFF00FF; 

    AA:=MA((2*CLOSE+HIGH+LOW)/4,9); 

    通道1:=AA*102/100; 

    CC:=ABS((2*CLOSE+HIGH+LOW)/4-MA(C,26))/MA(C,26); 

    DD:=DMA(CLOSE,CC); 

    通道2:=(1+7/100)*DD; 

    :MA(ATAN((通道2-REF(通道2,1))),3),LINETHICK2,COLORBLUE; 

    T1:=ATAN((通道1-REF(通道1,1))); 

    T2:=ATAN((通道1-REF(通道1,2))); 

    T3:=ATAN((通道1-REF(通道1,3))); 

    T4:=ATAN((通道1-REF(通道1,4))); 

    T5:=ATAN((通道1-REF(通道1,5))); 

    T6:=ATAN((通道1-REF(通道1,6))); 

    T7:=ATAN((通道1-REF(通道1,7))); 

    T8:=ATAN((通道1-REF(通道1,8))); 

    T9:=ATAN((通道1-REF(通道1,9))); 

    M:=IF(BARSCOUNT(C) =10,10,BARSCOUNT(C)); 

    STICKLINE(C =MA(C,M),MA(C,M),MA(C,M*0.7),4,0),COLORYELLOW; 

    STICKLINE(C MA(C,M),MA(C,M),MA(C,M*0.7),4,0),COLORBLUE; 

    DRAWKLINE(H,O,L,C); 

    Z:=MA(C,120); 

    VAR3:=(MA(C,5)-Z)/Z; 

    VAR4:=MA((CLOSE-LLV(LOW,20))/(HHV(HIGH,20)-LLV(LOW,20))*100,3); 

    VAR5:=(MA(AMOUNT,5)/MA(VOL,5)/100-MA(AMOUNT,120)/MA(VOL,120)/100)/(MA(AM 

    OUNT,5)/MA(VOL,5)/100); 

    Z1:=STRCAT(HYBLOCK,  

    Z2:=STRCAT(Z1,DYBLOCK); 

    Z3:=STRCAT(Z2,  

    DRAWTEXT_FIX(ISLASTBAR,0,0,0,STRCAT(Z3,GNBLOCK)),COLORRED; 

    涨家数:INDEXADV,NODRAW,COLORRED; 

    大盘跌家数:INDEXDEC,NODRAW,COLORGREEN; 

    :=IF((C-REF(C,1))*100/REF(C,1) =(10-0.01*100/REF(O,1)),1,0); 

    T10:=ATAN((通道1-REF(通道1,10))); 

    强度:=MA((((T1+T2+T3+T4+T5+T6+T7+T8+T9+T10)/10)),3),LINETHICK1,COLOR00FF0 

    0; 

    TT1:=ATAN((通道2-REF(通道2,1))); 

    TT2:=(ATAN((通道2-REF(通道2,2)))); 

    TT3:=(ATAN((通道2-REF(通道2,3)))); 

    TT4:=(ATAN((通道2-REF(通道2,4)))); 

    TT5:=(ATAN((通道2-REF(通道2,5)))); 

    TT6:=(ATAN((通道2-REF(通道2,6)))); 

    TT7:=(ATAN((通道2-REF(通道2,7)))); 

    TT8:=(ATAN((通道2-REF(通道2,8)))); 

    TT9:=(ATAN((通道2-REF(通道2,9)))); 

    TT10:=(ATAN((通道2-REF(通道2,10)))); 

    :=MA((((TT1+TT2+TT3+TT4+TT5+TT6+TT7+TT8+TT9+TT1*/ 

    N:=90; 

    M:=3; 

    低:=REF(LLV(L,N),M); 

    低点:=REFX1(低,10000); 

    RRF:低点=LAND((C-L) (O-C)OR(O-L) (C-O)),STICK; 

    STICKLINE1(IF(RRF,-120,0),+12,0,4,0),COLOR000088; 

    STICKLINE1(IF(RRF,-120,0),+12,0,3,0),COLOR0000AA; 

    STICKLINE1(IF(RRF,-120,0),+12,0,2,0),COLOR0000CC; 

    STICKLINE1(IF(RRF,-120,0),+12,0,1.4,0),COLOR0000EE; 

    STICKLINE1(IF(RRF,-120,0),+12,0,0.9,0),COLOR0000EE; 

    STICKLINE1(IF(RRF,-120,0),+12,0,0.3,0),COLORMAGENTA; 

    STICKLINE1(IF(RRF,-120,0),+9,0,7,0),COLOR770077; 

    STICKLINE1(IF(RRF,-120,0),+9,0,6,0),COLOR990099; 

    STICKLINE1(IF(RRF,-120,0),+9,0,5,0),COLORBB00BB; 

    STICKLINE1(IF(RRF,-120,0),+9,0,4,0),COLORDD00DD; 

    STICKLINE1(IF(RRF,-120,0),+9,0,3,0),COLORFF00FF; 

    STICKLINE1(IF(RRF,-120,0),+9,0,2,0),COLORDD00DD; 

    STICKLINE1(IF(RRF,-120,0),+6,0,7,0),COLOR003300; 

    STICKLINE1(IF(RRF,-120,0),+6,0,6,0),COLOR005500; 

    STICKLINE1(IF(RRF,-120,0),+6,0,5,0),COLOR007700; 

    STICKLINE1(IF(RRF,-120,0),+6,0,3.5,0),COLOR009900; 

    STICKLINE1(IF(RRF,-120,0),+6,0,2,0),COLOR00CC00; 

    STICKLINE1(IF(RRF,-120,0),+3,0,7,0),COLOR666666; 

    STICKLINE1(IF(RRF,-120,0),+3,0,6,0),COLOR777777; 

    STICKLINE1(IF(RRF,-120,0),+3,0,5,0),COLOR888888; 

    STICKLINE1(IF(RRF,-120,0),+3,0,4,0),COLOR999999; 

    STICKLINE1(IF(RRF,-120,0),+3,0,3,0),COLORDDDDDD; 

    STICKLINE1(IF(RRF,-120,0),+3,0,2,0),COLORFFFFFF; 

    STICKLINE1(IF(RRF,-120,0),-3,0,7,0),COLOR000044; 

    STICKLINE1(IF(RRF,-120,0),-3,0,6,0),COLOR000033; 

    STICKLINE1(IF(RRF,-120,0),-3,0,5,0),COLOR000055; 

    STICKLINE1(IF(RRF,-120,0),-3,0,4,0),COLOR000077; 

    STICKLINE1(IF(RRF,-120,0),-3,0,3,0),COLOR000099; 

    STICKLINE1(IF(RRF,-120,0),-3,0,2,0),COLORMAGENTA; 

    DRAWTEXT(RRF,10.5, ),COLORYELLOW; 

    DRAWTEXT(RRF,7.5, 翻 ),COLORYELLOW; 

    DRAWTEXT(RRF,4.5, 天 ),COLORRED; 

    DRAWTEXT(RRF,1.5, 印 ),COLORRED; 

    DRAWTEXT(RRF,-1.5, ),COLORYELLOW; 

    VAR1:=(2*CLOSE+HIGH+LOW)/4; 

    VAR2:=EMA(EMA(EMA(VAR1,4),4),4); 

    J:(VAR2-REF(VAR2,1))/REF(VAR2,1)*100,COLORSTICK; 

    D:MA(J,3); 

    K:MA(J,1); 

    DRAWICON(CROSS(D,J),J,2); 

    DRAWICON(CROSS(J,D),D,1); 

    BUYHAOGU:0 

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

    DEA:EMA(DIFF,9)COLORMAGENTA,LINETHICK1; 

    MACD:2*(DIFF-DEA),COLORSTICK,LINETHICK2; 

    A1:=BARSLAST(REF(CROSS(DIFF,DEA),1)); 

    底:=REF(CLOSE,A1+1) CLOSEANDDIFF REF(DIFF,A1+1)AND 

    CROSS(DIFF,DEA); 

    STICKLINE(底背离,0,0.03,6,0),COLOR00FF00; 

    底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4; 

    DRAWTEXT(底背离,0.12, 底背离 ),COLORFF00FF; 

    A2:=BARSLAST(REF(CROSS(DEA,DIFF),1)); 

    顶背离:=REF(CLOSE,A2+1) CLOSEANDREF(DIFF,A2+1) DIFFAND 

    CROSS(DEA,DIFF); 

    顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4; 

    AA2:=BARSLAST(REF(CROSS( KDJ.K (9,3,3), KDJ.D (9,3,3)),1)); 

    B2:=REF(C,AA2+1) CANDREF( KDJ.K (9,3,3),AA2+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) CAND 

    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)); 

    C2:=BARSLAST(REF(CROSS( KDJ.D (9,3,3), KDJ.K (9,3,3)),1)); 

    D2:=REF(C,C2+1) CANDREF( KDJ.K (9,3,3),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) CAND 

    REF( RSI.RSI1 (6,12,24),C3+1) RSI.RSI1 (6,12,24)AND 

    CROSS( RSI.RSI2 (6,12,24), RSI.RSI1 (6,12,24)); 

    KDJ底背:IF(B2 0,-0.1,0),COLORFF00FF,POINTDOT; 

    RSI底背:IF(B3 0,-0.1,0),COLORYELLOW,POINTDOT; 

    KDJ顶背:IF(D2 0,0.1,0),COLORFFCC66,POINTDOT; 

    RSI顶背:IF(D3 0,0.1,0),COLORWHITE,POINTDOT; 

    首红长:0,COLORRED; 

    首绿短:0,COLORGREEN; 

    STICKLINE(B2 0,-0.04,0,2,0),COLORFF00FF; 

    STICKLINE(B3 0,-0.05,0,2,0),COLORYELLOW; 

    STICKLINE(D2 0,0.04,0,2,0),COLORFFCC66; 

    STICKLINE(D3 0,0.05,0,2,0),COLORWHITE; 

    红首长:=MACD 0ANDREF(MACD,1)  

    STICKLINE(红首长,0.03,MACD,2,0),COLORRED; 

    DRAWICON(红首长,0.04,1); 

    绿首短:=MACD 0ANDMACD REF(MACD,1)AND 

    REF(MACD,1) REF(MACD,2) 

    ANDREF(MACD,2) REF(MACD,3) 

    ANDREF(MACD,3) REF(MACD,4); 

    STICKLINE(绿首短,0.03,MACD,2,0),COLORGREEN; 

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

    DEA1:=EMA(DIF1,9); 

    1:=CROSS(DIF1,DEA1); 

    RSV:=(CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9)); 

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

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

    J:=3*K-2*D; 

    金叉2:=CROSS(J,K); 

    DRAWTEXT(金叉1AND金叉2,金叉1AND金叉2, 

    0.03 ),STICK,COLOR0099FF;


    image.png



    二、macd实战指标公式

     

    VAR1:=EMA(EMA(CLOSE,13),13); 

    控盘指 

    数:(VAR1-REF(VAR1,1))/REF(VAR1,1)*1000,POINTDOT,COLORFF 

    CCCC; 

    STICKLINE(控盘指数0,控盘指数,0,2,0),COLORGRAY; 

    无庄控盘:控盘指数0,LINETHICK0,COLORGRAY; 

    STICKLINE(控盘指数REF(控盘指数,1)AND控盘指数0AND控盘 

    指数3,控盘指数,0,2,1),COLORRED; 

    STICKLINE(控盘指数REF(控盘指数,1)AND控盘指数0AND控盘 

    指数3,控盘指数,0,2,1),COLORRED; 

    STICKLINE(控盘指数REF(控盘指数,1)AND控盘指数3,控盘指 

    数,3,4,1),COLORFF00FF; 

    控盘:控盘指数REF(控盘指数,1)AND控盘指数 

    0,LINETHICK0,COLORRED; 

    STICKLINE(控盘指数REF(控盘指数,1)AND控盘指数0,控盘指 

    数,0,2,0),COLOR00FF00; 

    控盘减弱:控盘指数REF(控盘指数,1)AND控盘指数 

    0,LINETHICK0,COLOR00FF00; 

    VARA:=EMA(0.667*REF(控盘指数,1)+0.333*控盘指数,2); 

    STICKLINE(控盘指数VARA,控盘指数,VARA,2,0),COLORRED; 

    B2:=控盘指数VARA; 

    准备:B2REF(B2,1)AND控盘指数(-2),COLORYELLOW; 

    DRAWTEXT(准备,3,准备),COLORYELLOW; 

    B1:=(控盘指数REF(控盘指数,1)AND控盘指数0)=1; 

    开始控盘:B1REF(B1,1),COLORMAGENTA,LINETHICK3; 

    A:=(3*C+L+O+H)/6; 

    X:=(20*A+19*REF(A,1)+18*REF(A,2)+17*REF(A,3)+16*REF(A,4) 

    +15*REF(A,5)+ 

    14*REF(A,6)+13*REF(A,7)+12*REF(A,8)+11*REF(A,9)+10*REF(A, 

    10)+9*REF(A,11)+8*REF(A,12) 

    +7*REF(A,13)+6*REF(A,14)+5*REF(A,15)+4*REF(A,16)+3*REF(A, 

    17)+2*REF(A,18)+ 

    REF(A,20))/210; 

    MTM:=C-REF(C,1); 

    DX:=100*EMA(EMA(MTM,6),6)/EMA(EMA(ABS(MTM),6),6); 

    CB:=EMA(X,13); 

    买:=IF(LLV(DX,2)=LLV(DX,7)ANDCOUNT(DX0,2)ANDCROSS(DX,M 

    A(DX,2)),1,0); 

    DRAWICON(FILTER(买=1,5),L*0.11,1); 

    DIFF:(EMA(CLOSE,12)-EMA(CLOSE,26))*20,COLORWHITE,LINET 

    HICK1; 

    DEA:EMA(DIFF,9),COLORYELLOW,LINETHICK1; 

    MACD:2*(DIFF-DEA),COLORSTICK; 

    MACD1:=2*(DIFF-DEA),COLORRED,NODRAW; 

    MACD2:=EMA(MACD1,3),COLORCYAN,NODRAW; 

    STICKLINE(MACD1MACD2ANDMACD10,0,MACD1,2,0),COLORRE 

    D; 

    STICKLINE(MACD1MACD2ANDMACD10,0,MACD1,2,0),COLORYE 

    DIF1:=EMA(DCLOSE,12)-EMA(DCLOSE,26); 

    DEA1:=EMA(DIF1,9); 

    {柱状线} 

    AAA1:=(DIF1-DEA1)*2*60; 

    AAA上:IF(AAA1 REF(AAA1,1),AAA1,DRAWNULL), 

    STICK,COLORRED,LINETHICK1; 

    AAA下:IF(AAA1 REF(AAA1,1),AAA1,DRAWNULL),STICK,COLORYELLOW,LINETHICK1; 

    买入线:15; 

    房子:AAA1-REF(AAA1,1),COLORRED; 

    DRAWICON(CROSS(房子,买入线),买入线,9);


    image.png


    [源码注释]通达信公式动态公式解读


    输出XG:(手) 上次30日内成交量(手)的最高值=成交量(手)距今天数日前的成交量(手)*0.4




    推荐阅读:增强版macd指标公式源码

     

    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)AND 

    REF(MACD2,1) REF(MACD2,2)ANDREF(MACD2,2) REF(MACD2,3),MACD2,2); 

    DRAWICON(HHV(MACD2,4) 0ANDMACD2 REF(MACD2,1)AND 

    REF(MACD2,1) REF(MACD2,2)ANDREF(MACD2,2) REF(MACD2,3),MACD2,1); 

    DRAWICON((JUD1ORBARSLAST(JDU1) BARSLAST(JUD1))ANDMACD2 =0AND 

    REF(MACD2,1) REF(DEFU2L,1)ANDMACD2 DEFU2L,MACD2,5); 

    DRAWICON((JDU1ORBARSLAST(JDU1) BARSLAST(JUD1))ANDMACD2 0AND 

    REF(MACD2,1) REF(DEFD2L,1)ANDMACD2 DEFD2L,MACD2,3); 

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

    VAR112:=HHV(MACD2,4) 0ANDMACD2 REF(MACD2,1)AND 

    REF(MACD2,1) REF(MACD2,2)ANDREF(MACD2,2) REF(MACD2,3); 

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

    DIF:EMA(CLOSE,12)-EMA(CLOSE,26),LINETHICK2; 

    DEA:EMA(DIF,9),COLORWHITE; 

    MACD:(DIF-DEA)*2,NODRAW; 

    DRAWBAND(DIF,RGB(150,20,20),DEA,RGB(10,150,20)); 

    DRAWBAND(IF(DIF,DIF,DRAWNULL),RGB(250,250,250),DIF,RGB(0,0,0)); 

    DRAWBAND(IF(DEA,DEA,DRAWNULL),RGB(250,250,10),DEA,RGB(0,0,0)); 

    上堆小缩头卖:(DIF-DEA)*2,COLORSTICK; 

    空中加油再续航:上堆小缩头卖,NODRAW; 

    VARF:=TROUGHBARS(3,15,1)  

    多空:=EMA((CLOSE-MA((2*CLOSE+HIGH+LOW)/4,30)) 

    /MA((2*CLOSE+HIGH+LOW)/4,30)*100,3),LINETHICK1,COLORYELLOW; 

    STICKLINE(FILTER(VARF=1,5)AND多空 -10,空中加油再续航,0,3.2,1),COLOR00FFFF; 

    STICKLINE(FILTER(VARF=1,5),空中加油再续航,0,4,0),COLORRED; 

    STICKLINE(MACD 0,0,MACD,1,0),COLORRED; 

    STICKLINE(MACD 0,0,MACD,1,0),COLORGREEN; 

    STICKLINE(MACD 0ANDMACD =REF(MACD,1),0,MACD,1,0),COLORYELLOW; 

    STICKLINE(MACD 0ANDMACD =REF(MACD,1),0,MACD,1,0),COLORWHITE; 

    FH1:=REF(MACD,1) REF(MACD,2)ANDREF(MACD,2) REF(MACD,3)AND 

    REF(MACD,3) REF(MACD,4); 

    FH2:=MACD =0ANDCOUNT(MACD REF(MACD,1),1)=1; 

    FH3:=FH1ANDFH2ANDEMA(C,13) REF(EMA(C,13),1); 

    FH4:=FH1ANDFH2ANDABS((DIF-DEA)/C) 0.018; 

    FH5:=FH1ANDFH2ANDMACD 0.10; 

    VV:=CLOSE OPENANDMA(CLOSE,5) MA(CLOSE,10)AND 

    MA(CLOSE,10) MA(CLOSE,30) 

    ANDDIFF DEAANDMACD REF(MACD,1)ANDDIFF 0ANDDEA 0AND 

    MA(VOL,5) MA(VOL,34)ANDMA(CLOSE,30) =REF(MA(CLOSE,30),1); 

    佛手:IF(VV,1,0),NODRAW; 

    DRAWICON(佛手,0.06,11); 

    二次翻红:(FH3ORFH4ORFH5),COLORRED,NODRAW; 

    低买:CROSS(DIF,DEA)ANDDIF 0,COLORFF00FF,NODRAW; 

    加油:CROSS(DIF,DEA)ANDDIF 0,COLORYELLOW,NODRAW; 

    DRAWICON(二次翻红,-0.05,1); 

    DRAWTEXT(二次翻红,-0.15, ↖翻红 ),COLORRED; 

    DRAWTEXT(CROSS(DIF,DEA)ANDDIF 0,DEA-0.02, ↖低买 ),COLORFF00FF; 

    DRAWTEXT(CROSS(DIF,DEA)ANDDIF 0,DEA-0.05, ↖加油 ),COLORYELLOW; 

    XG:二次翻红OR低买OR加油,NODRAW; 

    YLZC:=IF(CLOSE=INDEXC,(INDEXC+INDEXH+INDEXL+INDEXO)/4,AMOUNT/(VOL+0.01 

    )/100); 

    阻价:=IF(CLOSE=INDEXC,YLZC+INDEXC-INDEXL,YLZC+(CLOSE-LOW)); 

    支价:=IF(CLOSE=INDEXC,INDEXL+INDEXC-YLZC,LOW+(CLOSE-YLZC)); 

    今压:REF(阻价,1),LINETHICK0,COLORAA11BB,NODRAW; 

    今撑:REF(支价,1),LINETHICK0,COLOR009900,NODRAW; 

    明压:阻价,LINETHICK0,NODRAW; 

    明撑:支价,LINETHICK0,NODRAW; 

    低位金叉:=CROSS(DIFF,DEA)ANDDIFF -0.1; 

    STICKLINE(低位金叉,0,0.08,6,0),COLORYELLOW; 

    DRAWTEXT(低位金叉,0.16, 低位金叉 ),COLORWHITE; 

    JCCOUNT:=COUNT(CROSS(DIFF,DEA),BARSLAST(DEA =0)); 

    二次金叉:=CROSS(DIFF,DEA)ANDDEA 0ANDCOUNT(JCCOUNT=2,21)=1; 

    STICKLINE(二次金叉,0,0.06,6,0),COLORFF00FF; 

    DRAWICON(二次金叉,DEA*0.9,1); 

    DRAWTEXT(二次金叉,0.2, 二次金叉 ),COLORYELLOW; 

    A1:=BARSLAST(REF(CROSS(DIFF,DEA),1)); 

    底背离:=REF(CLOSE,A1+1) CLOSEANDDIFF REF(DIFF,A1+1)ANDCROSS(DIFF,DEA); 

    STICKLINE(底背离,0,0.03,6,0),COLOR00FF00; 

    底背:DRAWLINE(A1=0,DEA,底背离,DEA,0),COLORRED,LINETHICK4; 

    DRAWTEXT(底背离,0.12, 底背离 ),COLORFF00FF; 

    A2:=BARSLAST(REF(CROSS(DEA,DIFF),1)); 

    顶背离:=REF(CLOSE,A2+1) CLOSEANDREF(DIFF,A2+1) DIFFANDCROSS(DEA,DIFF); 

    顶背:DRAWLINE(A2=0,DEA,顶背离,DEA,0),COLORGREEN,LINETHICK4; 

    DRAWTEXT(低位金叉AND二次金叉AND底背离,0.25, 三全项 

    ),COLOR0000FF,LINETHICK2; 

    入1:IF(DIF REF(DIF,1),DIF,DRAWNULL),COLORRED,LINETHICK2; 

    入2:IF(DIF REF(DIF,1),DIF,DRAWNULL),COLOR00FF00,LINETHICK2;


    image.png


    九毛八公式指标,一个优质的公式指标平台!
    九毛八公式指标 » 改良macd指标公式源码(macd实战指标公式) 加入收藏