N:=1000;P:=5;P1:=10;{N为多少天内的高低值参数,我以自已的初始K线根数定义。P1、P2为短、长支撑压力取点参数}
A1:=REF(H,P)=HHV(H,2*P+1);
B1:=FILTER(A1,P);
C1:=BACKSET(B1,P+1);
D1:=FILTER(C1,P);
E1:=BACKSET(ISLASTBAR,BARSLAST(D1)+1);
F1:=E1 REF(E1,1);
短压:DRAWLINE(D1,H,F1,H,1),COLORCYAN;
A2:=REF(L,P)=LLV(L,2*P+1);
B2:=FILTER(A2,P);
C2:=BACKSET(B2,P+1);
D2:=FILTER(C2,P);
E2:=BACKSET(ISLASTBAR,BARSLAST(D2)+1);
F2:=E2 REF(E2,1);
短支:DRAWLINE(D2,L,F2,L,1),COLORLIRED;
AA1:=REF(H,P1)=HHV(H,2*P1+1);
BB1:=FILTER(AA1,P1);
CC1:=BACKSET(BB1,P1+1);
DD1:=FILTER(CC1,P1);
EE1:=BACKSET(ISLASTBAR,BARSLAST(DD1)+1);
FF1:=EE1 REF(EE1,1);
长压:DRAWLINE(DD1,H,FF1,H,1),COLORGREEN;
AA2:=REF(L,P1)=LLV(L,2*P1+1);
BB2:=FILTER(AA2,P1);
CC2:=BACKSET(BB2,P1+1);
DD2:=FILTER(CC2,P1);
EE2:=BACKSET(ISLASTBAR,BARSLAST(DD2)+1);
FF2:=EE2 REF(EE2,1);
长支:DRAWLINE(DD2,L,FF2,L,1),COLORRED;
STICKLINE(C =O,C,O,3,0),COLOR000045;
STICKLINE(C =O,C,O,2.5,0),COLOR000065;
STICKLINE(C =O,C,O,2,0),COLOR000085;
STICKLINE(C =O,C,O,1.5,0),COLOR0000A5;
STICKLINE(C =O,C,O,1,0),COLOR0000C5;
STICKLINE(C =O,C,O,0.5,0),COLOR0000E5;
STICKLINE(C =O,H,L,0,0),COLOR0000F5;
STICKLINE(C O,C,O,3,0),COLOR353500;
STICKLINE(C O,C,O,2.5,0),COLOR454500;
STICKLINE(C O,C,O,2,0),COLOR555500;
STICKLINE(C O,C,O,1.5,0),COLOR656500;
STICKLINE(C O,C,O,1,0),COLOR757500;
STICKLINE(C O,C,O,0.5,0),COLOR858500;
STICKLINE(C O,H,L,0,0),COLOR959500;
高:=REFDATE(HHV(H,N),DATE);
低:=REFDATE(LLV(L,N),DATE);
H1:=高-(高-低)*0.191;
H2:=高-(高-低)*0.382;
H3:=高-(高-低)*0.5;
H4:=高-(高-低)*0.618;
H5:=高-(高-低)*0.809;
H6:=高-(高-低)*0.764;
STICKLINE(CURRBARSCOUNT=13,高,高,100,1),COLORGREEN;
STICKLINE(CURRBARSCOUNT=13,H1,H1,100,1),COLORCYAN;
STICKLINE(CURRBARSCOUNT=13,H2,H2,100,1),COLORCCCCCC;
DRAWTEXT(CURRBARSCOUNT=1,高,' 高'),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=1,H1,'0.809'),COLORCYAN;
DRAWTEXT(CURRBARSCOUNT=1,H2,' 0.618'),COLORFFFFFF;
DRAWTEXT(CURRBARSCOUNT=1,H3,' 中'),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=1,H4,' 0.382'),COLORLIRED;
DRAWTEXT(CURRBARSCOUNT=1,H6,' 0.236'),COLORLIRED;
DRAWTEXT(CURRBARSCOUNT=1,H5,' 0.191'),COLORMAGENTA;
DRAWTEXT(CURRBARSCOUNT=1,低,' 低'),COLORRED;
STICKLINE(CURRBARSCOUNT=13,H3,H3,100,1),COLORYELLOW;
STICKLINE(CURRBARSCOUNT=13,H4,H4,100,1),COLORLIRED;
STICKLINE(CURRBARSCOUNT=13,H6,H6,100,1),COLORLIRED;
STICKLINE(CURRBARSCOUNT=13,H5,H5,100,1),COLORMAGENTA;
STICKLINE(CURRBARSCOUNT=13,低,低,100,1),COLORRED;
DRAWTEXT(CURRBARSCOUNT=25,高*0.99,CON2STR(高,2)),COLORGREEN;
DRAWTEXT(CURRBARSCOUNT=25,H1,CON2STR(H1,2)),COLORCYAN;
DRAWTEXT(CURRBARSCOUNT=25,H2,CON2STR(H2,2)),COLORFFFFFF;
DRAWTEXT(CURRBARSCOUNT=25,H3,CON2STR(H3,2)),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=25,H6,CON2STR(H6,2)),COLORYELLOW;
DRAWTEXT(CURRBARSCOUNT=25,H4,CON2STR(H4,2)),COLORLIRED;
DRAWTEXT(CURRBARSCOUNT=25,H5,CON2STR(H5,2)),COLORMAGENTA;
DRAWTEXT(CURRBARSCOUNT=25,低*1.01,CON2STR(低,2)),COLORRED;
HDAY:=100;LDAY:=100;调点:=3;角度:=100;之字幅度:=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);
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;
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);
{DRAWTEXT(CURR=GTHT,SX涨L-IM68,'牛金画线'),COLOR8899AA;}
天线:=SX跌H;
地线:=SX涨L;
上斜线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)COLORRED;
上8:IF(上斜线8 =天线*1.05,上斜线8,DRAWNULL)COLORRED;
上7:IF(上斜线7 =天线*1.05,上斜线7,DRAWNULL)COLORRED;
上6:IF(上斜线6 =天线*1.05,上斜线6,DRAWNULL)COLORRED;
上5:IF(上斜线5 =天线*1.05,上斜线5,DRAWNULL)COLORYELLOW;
上4:IF(上斜线4 =天线*1.05,上斜线4,DRAWNULL)COLORRED;
上3:IF(上斜线3 =天线*1.05,上斜线3,DRAWNULL)COLORRED;
上2:IF(上斜线2 =天线*1.05,上斜线2,DRAWNULL)COLORRED;
上1:IF(上斜线1 =天线*1.05,上斜线1,DRAWNULL)COLORRED;
下斜线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),COLORGREEN;
下8:IF(下斜线8 =地线*0.95,下斜线8,DRAWNULL),COLORGREEN;
下7:IF(下斜线7 =地线*0.95,下斜线7,DRAWNULL),COLORGREEN;
下6:IF(下斜线6 =地线*0.95,下斜线6,DRAWNULL),COLORGREEN;
下5:IF(下斜线5 =地线*0.95,下斜线5,DRAWNULL),COLORYELLOW;
下4:IF(下斜线4 =地线*0.95,下斜线4,DRAWNULL),COLORGREEN;
下3:IF(下斜线3 =地线*0.95,下斜线3,DRAWNULL),COLORGREEN;
下2:IF(下斜线2 =地线*0.95,下斜线2,DRAWNULL),COLORGREEN;
下1:IF(下斜线1 =地线*0.95,下斜线1,DRAWNULL),COLORGREEN;
下面为通达信黄金分割江恩角度线主图指标公式演示图片