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

    正文概述    2024-04-07 23:26:52  
    DIFF:=(EMA(CLOSE,SHORT)/EMA(CLOSE,LONG)-1)*100;
    partline(diff,diff ref(diff,1),rgb(255,0,0),diff ref(diff,1),rgb(0,255,0)),linethick2;
    DEA:EMA(DIFF,M),coloryellow;
    MACD:3*(DIFF-DEA), COLORSTICK;
    macdx:macd;
    partline(macdx,macdx ref(macdx,1),rgb(255,0,0),macdx ref(macdx,1),rgb(0,255,0));
    Var1:=EMA(CLOSE,35)-EMA(CLOSE,17);
    Var2:=EMA(Var1,5);
    jgdx:TROUGHBARS(3,10,1) 1 AND CROSS(Var1,Var2),colorred;
    {zds:=hhvall(macdx);
    RSV:=((CLOSE-LLV(LOW,9))/(HHV(HIGH,9)-LLV(LOW,9))*zds)-(zds/2);
    K:=SMA(RSV,3,1);
    D:=SMA(K,3,1);
    Jb:=3*K-2*D;
    zdjb:=hhvall(jb);
    j:jb*zds/zdjb;
    DRAWTEXTABS(40,5,'图中白色线为KDJ的J线'),Colorred;}
    {difa:=abs(diff);
    diff角度:=atan((difa/ref(difa,2)-1)*100)*180/3.1415926535;
    DRAWTEXTABS(40,10,'■diff角度:'+NUMTOSTRN(diff角度,2)+''),ColorFFFF00;}
    {drawtextabs(440,10,'!!注意: 日K线的bbiday的颜色变化和MACD的背离信号!!'),colorred;}
    {diffday: macd.diff#day }
    jc:=cross(diff,dea);
    sc:=cross(dea,diff);
    djck:=(count(jc,barslast(diff 0)));
    ssjc:=(count(jc,barslast(diff 0)));
    usck:=(count(sc,barslast(diff 0)));
    jcd:=if(jc,dea,0);{金叉点}
    scd:=if(sc,dea,0);{死叉点}
    drawtext(jc and diff 0,jcd,numtostr(djck)+'金叉'),colorred;
    drawtext(jc and diff 0,jcd,numtostr(ssjc)+'金叉'),colorred;
    drawtext(sc and diff 0,scd,numtostr(usck)+'死叉'),colorgreen;
    A1:=BARSLAST(ref(cross(diff,dea) and dea 0,1));
    B1:=ref(c,A1+1) c and ref(diff,A1+1) diff and cross(diff,dea) and dea
    DRAWTEXT(FILTER(B1 0,5),diff-0.01,'*MACD底背离'),COLOryellow;
    C1:=BARSLAST(ref(cross(dea,diff),1)) and dea
    D1:=ref(c,C1+1) c and ref(diff,C1+1) diff and cross(dea,diff) and dea
    DRAWTEXT(FILTER(D1 0,5),diff+0.01,'*MACD顶背离'),COLORred;
    {gd:=if(diff ref(diff,1) and ref(diff,1) ref(diff,2) and ref(diff,2) ref(diff,3) and ref(diff,3) ref(diff,4),ref(diff,2),0);
    gdk:=count(gd 0,barslast(diff
    drawtext(gd 0 and diff 0,ref(diff,2),numtostr(gdk)+'拐点'),coloryellow;}
    {0007--MACD金死叉间最大、最小值}
    A1:=CROSS( MACD.MACD ,0);
    A2:=BARSLAST(A1);
    A3:=HHVBARS( MACD.MACD ,A2+1);
    A4:=BACKSET(REF(A3 =1,1) AND MACD.MACD 0,A3);
    A5:=BACKSET(REF(A4=0,1) AND A4=1,2);
    高值:IF(FILTER(A5,2), MACD.MACD ,0);
    DRAWICON(高值 0,高值,4);
    B1:=CROSS(0, MACD.MACD
    B2:=BARSLAST(B1);
    B3:=LLVBARS( MACD.MACD ,B2+1);
    B4:=BACKSET(REF(B3 =1,1) AND MACD.MACD 0,B3);
    B5:=BACKSET(REF(B4=0,1) AND B4=1,2);
    低值:IF(FILTER(B5,2), MACD.MACD ,0);
    DRAWICON(低值 0,低值,5);
    {A1:=BARSLAST(ref(cross(diff,dea),1));
    B1:=ref(c,A1+1) c and ref(diff,A1+1) diff and cross(diff,dea);
    DRAWTEXT(FILTER(B1 0,5),0,'MACD'),COLORGREEN,ALIGN0;;
    Stickline(FILTER(B1 0,5),-1,0,1,0),COLORGREEN;
    {A2:=BARSLAST(ref(cross( kdj.k , kdj.d ),1));
    B2:=ref(c,A2+1) c and ref( kdj.k ,A2+1) kdj.k and cross( kdj.k , kdj.d
    DRAWTEXT(FILTER(B2 0,5),0.5,'KDJ'),COLORYELLOW,ALIGN0;;
    Stickline(FILTER(B2 0,5),0.5,-1,1,0),COLORYELLOW;
    A3:=BARSLAST(ref(cross( RSI.RSI1 , RSI.RSI2 ),1));
    B3:=ref(c,A3+1) c and ref( RSI.RSI1 ,A3+1) RSI.RSI1 and cross( RSI.RSI1 , RSI.RSI2
    DRAWTEXT(FILTER(B3 0,5),-0.25,'RSI'),COLORCYAN,ALIGN0;;
    Stickline(FILTER(B3 0,5),-1,-0.25,1,0),COLORCYAN;}
    {C1:=BARSLAST(ref(cross(dea,diff),1));
    D1:=ref(c,C1+1) c and ref(diff,C1+1) diff and cross(dea,diff);
    DRAWTEXT(FILTER(D1 0,5),-0.5,'MACD'),COLORwhite,ALIGN0;
    Stickline(FILTER(D1 0,5),-0.5,1,1,0),COLORwhite;
    {C2:=BARSLAST(ref(cross( kdj.d , kdj.k ),1));
    D2:=ref(c,C2+1) c and ref( kdj.k ,C2+1) kdj.k and cross( kdj.d , kdj.k
    DRAWTEXT(FILTER(D2 0,5),0,'KDJ'),COLORwhite,ALIGN0;
    Stickline(FILTER(D2 0,5),1,0,1,0),COLORwhite;
    C3:=BARSLAST(ref(cross( RSI.RSI2 , RSI.RSI1 ),1));
    D3:=ref(c,C3+1) c and ref( RSI.RSI1 ,C3+1) RSI.RSI1 and cross( RSI.RSI2 , RSI.RSI1
    DRAWTEXT(FILTER(D3 0,5),0.25,'RSI'),COLORMAGENTA,ALIGN0;;
    Stickline(FILTER(D3 0,5),1,0.25,1,0),COLORMAGENTA;};


    九毛八公式指标,一个优质的公式指标平台!
    九毛八公式指标 » 大智慧MACD改进指标(源码) 加入收藏