A1:=REF(HIGH,3)=HHV(HIGH,2*3+1); B1:=FILTER(A1,3); C1:=BACKSET(B1,3+1); D1:=FILTER(C1,3);{高点}
A2:=REF(LOW,3)=LLV(LOW,2*3+1); B2:=FILTER(A2,3); C2:=BACKSET(B2,3+1); D2:=FILTER(C2,3);{低点}
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2; E2:=(HIGH+LOW)/2;{高低点出现在同一K线上时可作取舍}
Hj1:=(D1 AND NOT(D2 AND E1>=E2)) OR barstatus=2 OR BARSCOUNT(CLOSE)=1;
Lj1:=(D2 AND NOT(D1 AND E1<E2)); Hj2:=D1 AND NOT(D2 AND E1>=E2);
X1:=REF(BARSLAST(Hj1),1)+1; F1:=BACKSET(Hj1 AND COUNT(Lj1,X1)>0,LLVBARS(IF(Lj1,LOW,10000),X1));
G1:=F1>REF(F1,1); I1:=BACKSET(G1,2); LD:=I1>REF(I1,1);{过滤后低点}
DRAWTEXTABS,linethick1,COLOR00EEff;
Lj2:=LD OR barstatus=2 OR BARSCOUNT(CLOSE)=1;
X2:=REF(BARSLAST(Lj2),1)+1; F2:=BACKSET(Lj2 AND COUNT(Hj2,X2)>0,HHVBARS(IF(Hj2,HIGH,0),X2));
G2:=F2>REF(F2,1); I2:=BACKSET(G2,2); HD:=I2>REF(I2,1);{过滤后高点}
DRAWLINE(LD,L,HD,H,0),COLORyellow{,LINETHICK3},POINTDOT;
DRAWLINE(HD,H,LD,L,0),COLOR65eeff{,PLINETHICK3},POINTDOT;
drawicon(ld,l,1);drawicon(hd,h,8);ma5:ma(c,5);
ma20:ma(c,20),colorgreen;
PARTLINE(Ma20,Ma20>REF(Ma20,1),RGB(250,0,0)),linethick2;
ZTB:=C/REF(C,1)>1.097;
stickline(ZTB,l,h,8,0),COLORyellow;
DRAWTEXTREL(20,40,BKNAME),COLORffffFF;
流通盘:=FINANCE2(37)/10000;
DRAWTEXTABS(80,25,'流通盘:'+流通盘+'亿 '),LINETHICK1,Colorffffff;
{以下是两条趋势线原码}
UU:=BACKSET(barstatus=2 ,BARSLAST(LD)+1);
VV:=UU>REF(UU,1);
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);
XX:=WW>REF(WW,1);
DRAWLINE(XX,L,VV,L,1),COLORMAGENTA{,LINETHICK2};
UU2:=BACKSET(barstatus=2 ,BARSLAST(HD)+1);
VV2:=UU2>REF(UU2,1);
WW2:=BACKSET(VV2,REF(BARSLAST(HD),1)+2);
XX2:=WW2>REF(WW2,1);
DRAWLINE(XX2,h,VV2,h,1),COLORff44ff;
ab1:=zig(3,3); {N自行设置:一般为2、3、5、8、13、21等等}
n:=3;
ab2:=last(ab1>ref(ab1,1));
ab3:=last(ab1<ref(ab1,1));
tt1:=peak(1,N,1);
bb1:=trough(2,N,1);
H2:=tt1-(tt1-bb1)*0.382;
H4:=tt1-(tt1-bb1)*0.618;
H5:=tt1-(tt1-bb1)*0.764;
H7:=tt1-(tt1-bb1)*1.27;
H8:=tt1-(tt1-bb1)*1.618;
L2:=bb1+(tt1-bb1)*0.382;
L4:=bb1+(tt1-bb1)*0.618;
L5:=bb1+(tt1-bb1)*0.764;
L7:=bb1+(tt1-bb1)*1.27;
L8:=bb1+(tt1-bb1)*1.618;
stickline(ab3>0,tt1,tt1,8,0),linethick2,color00ff00;
stickline(ab2>0,bb1,bb1,8,0),linethick2,colorred;
stickline(ab3>0,H2,H2,4,0),linethick0,colorFF99CC;
stickline(ab3>0,H4,H4,4,0),linethick0,colorFF99CC;
stickline(ab3>0,H5,H5,4,0),linethick0,colorFF99CC;
stickline(ab3>0,H7,H7,4,0),linethick0,colorFF99CC;
stickline(ab3>0,H8,H8,4,0),linethick0,colorFF99CC;
drawtext(ab3=1,H2,'38.2%'),linethick0,colorFF99CC;
drawtext(ab3=1,H4,'61.8%'),linethick0,colorFF99CC;
drawtext(ab3=1,H5,'76.4%'),linethick0,colorFF99CC;
drawtext(ab3=1,H7,'127%'),linethick0,colorFF99CC;
drawtext(ab3=1,H8,'161.8%'),linethick0,colorFF99CC;
stickline(ab2>0,L2,L2,4,0),linethick0,colorFF00ff;
stickline(ab2>0,L4,L4,4,0),linethick0,colorFF00ff;
stickline(ab2>0,L5,L5,4,0),linethick0,colorFF00ff;
stickline(ab2>0,L7,L7,4,0),linethick0,colorFF00ff;
stickline(ab2>0,L8,L8,4,0),linethick0,colorFF00ff;
drawtext(a2=1,L2*1.015,'38.2%'),linethick0,colorFF00cc;
drawtext(a2=1,L4*1.015,'61.8%'),linethick0,colorFF00CC;
drawtext(a2=1,L5*1.015,'76.4%'),linethick0,colorFF00CC;
drawtext(a2=1,L7*1.015,'127%'),linethick0,colorFF00CC;
drawtext(a2=1,L8*1.015,'161.8%'),linethick0,colorFF99CC;