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

    正文概述    2024-04-07 06:48:02  

    HDAY:=15;LDAY:=15;调点:=3;角度:=200;之字幅度:=25;横向调节:=1;
    局部低点预选A:=BACKSET(LLV(L,5) REF(LLV(L,4),1),4);
    局部低点预选B:=BACKSET(局部低点预选A=0 AND REF(局部低点预选A,1)=1,2);
    局部低点预选C:=IF(局部低点预选B=1 AND REF(局部低点预选B,1)=0,-1,0);
    局部高点预选A:=BACKSET(HHV(H,5) REF(HHV(H,4),1),4);
    局部高点预选B:=BACKSET(局部高点预选A=0 AND REF(局部高点预选A,1)=1,2);
    局部高点预选C:=IF(局部高点预选B=1 AND REF(局部高点预选B,1)=0,1,0);
    缺口判断:=IF(L REF(H,1),1,IF(H REF(L,1),-1,0));
    距前高天:=BARSLAST(局部高点预选C=1);
    距前低天:=BARSLAST(局部低点预选C=-1);
    小值周期:=LOWRANGE(L);
    大值周期:=TOPRANGE(H);
    低保留AA:=IF(局部低点预选C=-1 AND REF(距前高天,1) REF(距前低天,1) AND LLV(L,距前高天+1) REF(LLV(L,距前高天+1),1),-1,0);
    低保留AB:=IF(局部低点预选C=-1 AND REF(距前高天,1) =REF(距前低天,1) AND (距前高天 =4 OR LLV(缺口判断,距前高天)=-1 OR LLV(L,距前低天+2) REF(LLV(L,距前低天+1),1)),-1,0);
    低保留S:=IF((低保留AA=-1 OR 低保留AB=-1) AND L REF(H,距前高天+1),-1,0);
    预判:=IF((距前低天 4 AND HHV(缺口判断,距前低天)!=1) OR REF(低保留S,距前低天)=0,1,0);
    判断:=IF(局部高点预选C=1 AND REF(距前低天,1) =REF(距前高天,1) AND 预判=1 AND 大值周期 REF(小值周期,距前低天+1) AND 大值周期 REF(小值周期,距前低天) AND 大值周期 REF(大值周期,距前高天),1,0);
    高保留A:=IF(局部高点预选C=1 AND REF(距前低天,1) REF(距前高天,1) AND HHV(H,距前低天+1) REF(HHV(H,距前低天+1),1),1,0);
    高保留B:=IF(局部高点预选C=1 AND REF(距前低天,1) =REF(距前高天,1) AND REF(低保留S,距前低天)=-1 AND (距前低天 =4 OR HHV(缺口判断,距前低天)=1),1,0);
    高保留:=IF((高保留A=1 OR 高保留B=1 OR 判断=1) AND H REF(L,距前低天+1),1,0);
    预判A:=IF((距前高天 4 AND HHV(缺口判断,距前高天)!=1) OR REF(高保留,距前高天)=0,1,0);
    判断A:=IF(局部低点预选C=-1 AND REF(距前高天,1) =REF(距前低天,1) AND 预判A=1 AND 小值周期 REF(大值周期,距前高天+1) AND 小值周期 REF(大值周期,距前高天) AND 小值周期 REF(小值周期,距前低天),-1,0);
    低保留A:=IF(局部低点预选C=-1 AND REF(距前高天,1) REF(距前低天,1) AND LLV(L,距前高天+1) REF(LLV(L,距前高天+1),1),-1,0);
    低保留B:=IF(局部低点预选C=-1 AND REF(距前高天,1) =REF(距前低天,1) AND (距前高天 =4 OR LLV(缺口判断,距前高天)=-1 OR 判断A=-1),-1,0);
    低保留:=IF((低保留A=-1 OR 低保留B=-1) AND L REF(H,距前高天+1),-1,0);
    距前高天A:=BARSLAST(高保留=1);
    距前低天A:=BARSLAST(低保留=-1);
    预判X:=IF((距前低天A 4 AND HHV(缺口判断,距前低天A)!=1) OR REF(低保留,距前低天A)=0,1,0);
    判断X:=IF(局部高点预选C=1 AND REF(距前低天A,1) =REF(距前高天A,1) AND 预判X=1 AND 大值周期 REF(小值周期,距前低天A+1) AND 大值周期 REF(小值周期,距前低天A) AND 大值周期 REF(大值周期,距前高天A),1,0);
    高保留XA:=IF(局部高点预选C=1 AND REF(距前低天A,1) REF(距前高天A,1) AND HHV(H,距前低天A+1) REF(HHV(H,距前低天A+1),1),1,0);
    高保留XB:=IF(局部高点预选C=1 AND REF(距前低天A,1) =REF(距前高天A,1) AND REF(低保留,距前低天A)=-1 AND (距前低天A =4 OR HHV(缺口判断,距前低天A)=1),1,0);
    高保留X:=IF((高保留XA=1 OR 高保留XB=1 OR 判断X=1) AND H REF(L,距前低天A+1),1,0);
    预判XA:=IF((距前高天A 4 AND HHV(缺口判断,距前高天A)!=1) OR REF(高保留XA,距前高天A)=0,1,0);
    判断XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1) =REF(距前低天A,1) AND 预判XA=1 AND 小值周期 REF(大值周期,距前高天A+1) AND 小值周期 REF(大值周期,距前高天A) AND 小值周期 REF(小值周期,距前低天A),-1,0);
    低保留XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1) REF(距前低天A,1) AND LLV(L,距前高天A+1) REF(LLV(L,距前高天A+1),1),-1,0);
    低保留XB:=IF(局部低点预选C=-1 AND REF(距前高天A,1) =REF(距前低天A,1) AND (距前高天A =4 OR LLV(缺口判断,距前高天A)=-1 OR 判断XA=-1),-1,0);
    低保留X:=IF((低保留XA=-1 OR 低保留XB=-1) AND L REF(H,距前高天A+1),-1,0);
    距前高天YA:=BARSLAST(高保留X=1);
    距前低天YA:=BARSLAST(低保留X=-1);
    预判YX:=IF((距前低天YA 4 AND HHV(缺口判断,距前低天YA)!=1) OR REF(低保留X,距前低天YA)=0,1,0);
    判断YX:=IF(局部高点预选C=1 AND REF(距前低天YA,1) =REF(距前高天YA,1) AND 预判YX=1 AND 大值周期 REF(小值周期,距前低天YA+1) AND 大值周期 REF(小值周期,距前低天YA) AND 大值周期 REF(大值周期,距前高天YA),1,0);
    高保留YXA:=IF(局部高点预选C=1 AND REF(距前低天YA,1) REF(距前高天YA,1) AND HHV(H,距前低天YA+1) REF(HHV(H,距前低天YA+1),1),1,0);
    高保留YXB:=IF(局部高点预选C=1 AND REF(距前低天YA,1) =REF(距前高天YA,1) AND REF(低保留X,距前低天YA)=-1 AND (距前低天YA =4 OR HHV(缺口判断,距前低天YA)=1),1,0);
    高保留YX:=IF((高保留YXA=1 OR 高保留YXB=1 OR 判断YX=1) AND H REF(L,距前低天YA+1),1,0);
    预判YXA:=IF((距前高天YA 4 AND HHV(缺口判断,距前高天YA)!=1) OR REF(高保留YXA,距前高天YA)=0,1,0);
    判断YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1) =REF(距前低天YA,1) AND 预判YXA=1 AND 小值周期 REF(大值周期,距前高天YA+1) AND 小值周期 REF(大值周期,距前高天YA) AND 小值周期 REF(小值周期,距前低天YA),-1,0);
    低保留YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1) REF(距前低天YA,1) AND LLV(L,距前高天YA+1) REF(LLV(L,距前高天YA+1),1),-1,0);
    低保留YXB:=IF(局部低点预选C=-1 AND REF(距前高天YA,1) =REF(距前低天YA,1) AND (距前高天YA =4 OR LLV(缺口判断,距前高天YA)=-1 OR 判断YXA=-1),-1,0);
    低保留YX:=IF((低保留YXA=-1 OR 低保留YXB=-1) AND L REF(H,距前高天YA+1),-1,0);
    AAAD:=IF(高保留YX=1 AND 低保留YX=-1 AND H REF(H,REF(距前高天YA,1)+2),1,IF(高保留YX=1 AND 低保留YX=-1 AND L REF(L,REF(距前低天YA,1)+2),-1,0));
    极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD);
    高低点:IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL)),CIRCLEDOT,COLORYELLOW,LINETHICK5;
    XA:=DRAWLINE(极点保留=-1,L,REF(极点保留,1)=-1,REF(L,1),1);
    XB:=DRAWLINE(极点保留=1,H,REF(极点保留,1)=1,REF(H,1),1);
    XAS:=DRAWLINE(极点保留=-1,XB,REF(极点保留,1)=-1,REF(XB,1),1);
    XBS:=DRAWLINE(极点保留=1,XA,REF(极点保留,1)=1,REF(XA,1),1);
    XA45:=(XA+XAS)/2;
    XB45:=(XB+XBS)/2;
    XA63:=(XAS-XA)*3/4+XA;
    XB63:=XB-(XB-XBS)*3/4;
    DRAWBAND(XA45,RGB(0,150,100),XA63,RGB(0,150,100));
    DRAWBAND(XB45,RGB(185,96,9),XB63,RGB(185,96,9));
    DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
    CURR:=CURRBARSCOUNT;
    TCH:=CONST(FINDHIGH(H,0,HDAY*10,1));
    GTT:=CONST(BARSLAST(TCH=H))+1;
    SX跌H:=CONST(IF(GTT=1,H,REF(H,GTT-1)));
    BCL:=CONST(FINDLOW(L,0,LDAY*10,1));
    DTT:=CONST(BARSLAST(BCL=L))+1;
    SX涨L:=CONST(IF(DTT=1,L,REF(L,DTT-1)));
    涨点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(L=SX涨L)+1));
    跌点:=BARSSINCE(BACKSET(ISLASTBAR,BARSLAST(H=SX跌H)+1));
    最低:=IF(调点=1,跌点,IF(调点=2,涨点,IF(调点=3,涨点,跌点)));
    L斜率:=角度/IF(C 300,1000,10);
    最高:=IF(调点=1,跌点,IF(调点=2,涨点,IF(调点=3,跌点,涨点)));
    H斜率:=角度/IF(C 300,1000,10);
    IM68:=((SX跌H-SX涨L)/6-(SX跌H-SX涨L)/8);
    GH跌X:=SX跌H+(SX跌H-SX涨L)/8;
    DL涨X:=SX涨L-(SX跌H-SX涨L)/8;
    GTHT:=IF(DTT GTT,DTT,GTT);
    R:=ABS(GTT-DTT);
    DRAWBAND(IF(CURR =GTHT+R/8,SX跌H,DRAWNULL),RGB(8,168,168),SX跌H,RGB(8,168,168));
    DRAWBAND(IF(CURR =GTHT+R/8,SX涨L,DRAWNULL),RGB(8,168,168),SX涨L,RGB(8,168,168));
    DRAWBAND(IF(CURR =GTHT+R/8,(SX跌H+SX涨L)/2,DRAWNULL),RGB(8,168,168),(SX跌H+SX涨L)/2,RGB(8,168,168));
    {DRAWTEXT(CURR=GTHT,SX涨L-IM68,'牛金画线'),COLOR8899AA;}
    天线:=SX跌H;
    地线:=SX涨L;
    K:=(天线-地线)/(IF(跌点 =涨点,跌点,涨点)-IF(跌点 =涨点,涨点,跌点));
    上斜线1:=IF(地线+CONST(L斜率*1.618)*最低 =地线,地线+CONST(L斜率*1.618)*最低,DRAWNULL);
    上斜线2:=IF(地线+CONST(L斜率*1.000)*最低 =地线,地线+CONST(L斜率*1.000)*最低,DRAWNULL);
    上斜线3:=IF(地线+CONST(L斜率*0.618)*最低 =地线,地线+CONST(L斜率*0.618)*最低,DRAWNULL);
    上斜线4:=IF(地线+CONST(L斜率*0.382)*最低 =地线,地线+CONST(L斜率*0.382)*最低,DRAWNULL);
    上斜线5:=IF(地线+CONST(L斜率*0.316)*最低 =地线,地线+CONST(L斜率*0.316)*最低,DRAWNULL);
    上斜线6:=IF(地线+CONST(L斜率*0.250)*最低 =地线,地线+CONST(L斜率*0.250)*最低,DRAWNULL);
    上斜线7:=IF(地线+CONST(L斜率*0.156)*最低 =地线,地线+CONST(L斜率*0.156)*最低,DRAWNULL);
    上斜线8:=IF(地线+CONST(L斜率*0.092)*最低 =地线,地线+CONST(L斜率*0.092)*最低,DRAWNULL);
    上斜线9:=IF(地线+CONST(L斜率*0.055)*最低 =地线,地线+CONST(L斜率*0.055)*最低,DRAWNULL);
    上9:IF(上斜线9 =天线*1.05,上斜线9,DRAWNULL)COLOR8B2368;
    上8:IF(上斜线8 =天线*1.05,上斜线8,DRAWNULL)COLOR8B2368;
    上7:IF(上斜线7 =天线*1.05,上斜线7,DRAWNULL)COLOR8B2368;
    上6:IF(上斜线6 =天线*1.05,上斜线6,DRAWNULL)COLOR8B2368;
    上5:IF(上斜线5 =天线*1.05,上斜线5,DRAWNULL)COLORYELLOW;
    上4:IF(上斜线4 =天线*1.05,上斜线4,DRAWNULL)COLOR8B2368;
    上3:IF(上斜线3 =天线*1.05,上斜线3,DRAWNULL)COLOR8B2368;
    上2:IF(上斜线2 =天线*1.05,上斜线2,DRAWNULL)COLOR8B2368;
    上1:IF(上斜线1 =天线*1.05,上斜线1,DRAWNULL)COLOR8B2368;
    下斜线1:=IF(天线-CONST(H斜率*1.618)*最高 =天线,天线-CONST(H斜率*1.618)*最高,DRAWNULL);
    下斜线2:=IF(天线-CONST(H斜率*1.000)*最高 =天线,天线-CONST(H斜率*1.000)*最高,DRAWNULL);
    下斜线3:=IF(天线-CONST(H斜率*0.618)*最高 =天线,天线-CONST(H斜率*0.618)*最高,DRAWNULL);
    下斜线4:=IF(天线-CONST(H斜率*0.382)*最高 =天线,天线-CONST(H斜率*0.382)*最高,DRAWNULL);
    下斜线5:=IF(天线-CONST(H斜率*0.316)*最高 =天线,天线-CONST(H斜率*0.316)*最高,DRAWNULL);
    下斜线6:=IF(天线-CONST(H斜率*0.250)*最高 =天线,天线-CONST(H斜率*0.250)*最高,DRAWNULL);
    下斜线7:=IF(天线-CONST(H斜率*0.156)*最高 =天线,天线-CONST(H斜率*0.156)*最高,DRAWNULL);
    下斜线8:=IF(天线-CONST(H斜率*0.092)*最高 =天线,天线-CONST(H斜率*0.092)*最高,DRAWNULL);
    下斜线9:=IF(天线-CONST(H斜率*0.055)*最高 =天线,天线-CONST(H斜率*0.055)*最高,DRAWNULL);
    下9:IF(下斜线9 =地线*0.95,下斜线9,DRAWNULL),COLOR996600;
    下8:IF(下斜线8 =地线*0.95,下斜线8,DRAWNULL),COLOR996600;
    下7:IF(下斜线7 =地线*0.95,下斜线7,DRAWNULL),COLOR996600;
    下6:IF(下斜线6 =地线*0.95,下斜线6,DRAWNULL),COLOR996600;
    下5:IF(下斜线5 =地线*0.95,下斜线5,DRAWNULL),COLORYELLOW;
    下4:IF(下斜线4 =地线*0.95,下斜线4,DRAWNULL),COLOR996600;
    下3:IF(下斜线3 =地线*0.95,下斜线3,DRAWNULL),COLOR996600;
    下2:IF(下斜线2 =地线*0.95,下斜线2,DRAWNULL),COLOR996600;
    下1:IF(下斜线1 =地线*0.95,下斜线1,DRAWNULL),COLOR996600;
    最低1:=TROUGHBARS(L,之字幅度,1);
    P:=横向调节;
    N:=最低1;
    数列:=INTPART(LOG((1/SQRT(5))*(POW((1+SQRT(5))/2,N)-POW((1-SQRT(5))/2,N)))/POW(N*P,1/5)),NODRAW;
    低价:=REF(L,BARSLAST(最低1=0));
    高价:=CONST(HHV(H,最低1))*1.05;
    前低:DRAWLINE(最低1=0,L,ISLASTBAR,低价,0)COLORLIMAGENTA,DOTLINE;
    前高低:=HHV(H,最低1+1)=H;
    统计:=CROSS(COUNT(前高低,最低1)=4,0.5);
    KK:=BARSLAST(统计);
    PP:=IF(REF(C,BARSLAST(CROSS(COUNT(前高低,最低1)=3,0.5))) C,REF(C,BARSLAST(CROSS(COUNT(前高低,最低)=3,0.5))),H);
    基线:=REF(PP,BARSLAST(统计)),NODRAW;
    基差:=基线-低价,NODRAW;
    {横线加字}
    一0:=低价+(基差*0.618*1*POW(1.1,1-1));
    一:IF(CURRBARSCOUNT =CONST(KK) AND 一0 =高价,一0,DRAWNULL),DOTLINE,COLORAAAAAA;
    DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(一),'一'),COLORFFFFFF;
    二0:=低价+(基差*0.618*2*POW(1.1,2-1));
    二:IF(CURRBARSCOUNT =CONST(KK) AND 二0 =高价,二0,DRAWNULL),DOTLINE,COLORAAAAAA;
    {DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(二),'二'),COLORFFFFFF;}
    三0:=低价+(基差*0.618*3*POW(1.1,3-1));
    三:IF(CURRBARSCOUNT =CONST(KK) AND 三0 =高价,三0,DRAWNULL),DOTLINE,COLORAAAAAA;
    DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(三),'三'),COLORFFFFFF;
    四0:=低价+(基差*0.618*4*POW(1.1,4-1));
    四:IF(CURRBARSCOUNT =CONST(KK) AND 四0 =高价,四0,DRAWNULL),DOTLINE,COLORAAAAAA;
    {DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(四),'四'),COLORFFFFFF;}
    五0:=低价+(基差*0.618*5*POW(1.1,5-1));
    五:IF(CURRBARSCOUNT =CONST(KK) AND 五0 =高价,五0,DRAWNULL),DOTLINE,COLORAAAAAA;
    DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(五),'五'),COLORFFFFFF;
    六0:=低价+(基差*0.618*6*POW(1.1,6-1));
    六:IF(CURRBARSCOUNT =CONST(KK) AND 六0 =高价,六0,DRAWNULL),DOTLINE,COLORAAAAAA;
    {DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(六),'六'),COLORFFFFFF;}
    七0:=低价+(基差*0.618*7*POW(1.1,7-1));
    七:IF(CURRBARSCOUNT =CONST(KK) AND 七0 =高价,七0,DRAWNULL),DOTLINE,COLORAAAAAA;
    DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(七),'七'),COLORFFFFFF;
    八0:=低价+(基差*0.618*8*POW(1.1,8-1));
    八:IF(CURRBARSCOUNT =CONST(KK) AND 八0 =高价,八0,DRAWNULL),DOTLINE,COLORAAAAAA;
    {DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(八),'八'),COLORFFFFFF;}
    九0:=低价+(基差*0.618*9*POW(1.1,9-1));
    九:IF(CURRBARSCOUNT =CONST(KK) AND 九0 =高价,九0,DRAWNULL),DOTLINE,COLORAAAAAA;
    DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(九),'九'),COLORFFFFFF;
    十0:=低价+(基差*0.618*10*POW(1.1,10-1));
    十:IF(CURRBARSCOUNT =CONST(KK) AND 十0 =高价,十0,DRAWNULL),DOTLINE,COLORAAAAAA;
    {DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(十),'十'),COLORFFFFFF;}
    II0:=低价+(基差*0.618*11*POW(1.1,11-1));
    II:IF(CURRBARSCOUNT =CONST(KK) AND II0 =高价,II0,DRAWNULL),DOTLINE,COLORAAAAAA;{竖线加字}
    STICKLINE(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1),低价,高价,0.00001,-1),COLORAAAAAA;
    DRAWTEXT(CURRBARSCOUNT=CONST(KK)+5,CONST(II),'II'),COLORFFFFFF;
    DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)
    AND 数列=1 ,高价*0.98,'一'),COLORFFFF00;
    {DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)
    AND 数列=2 ,高价*0.98,'二'),COLORFFFF00;}
    DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)
    AND 数列=3 ,高价*0.98,'三'),COLORFFFF00;
    {DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)
    AND 数列=4 ,高价*0.98,'四'),COLORFFFF00;}
    DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)
    AND 数列=5 ,高价*0.98,'五'),COLORFFFF00;
    {DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)
    AND 数列=6 ,高价*0.98,'六'),COLORFFFF00;}
    DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)
    AND 数列=7 ,高价*0.98,'七'),COLORFFFF00;
    {DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)
    AND 数列=8 ,高价*0.98,'八'),COLORFFFF00;}
    DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)}
    AND 数列=9 ,高价*0.98,'九'),COLORFFFF00;
    {DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)
    AND 数列=10 ,高价*0.98,'十'),COLORFFFF00;}
    {DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)}
    {AND 数列=11 ,高价*0.98,'十一'),COLORFFFF00;
    {DRAWTEXT(CURRBARSCOUNT =CONST(KK) AND 数列!=REF(数列,1)
    AND 数列=12 ,高价*0.98,'十二'),COLORFFFF00;};

    通达信牛金角线主图指标公式


    九毛八公式指标,一个优质的公式指标平台!
    九毛八公式指标 » 牛金角线主图指标 (源码) 加入收藏