[PEL] 复制代码
con1:=h>refx(h,1) and h>refx(h,2) and h=hhv(h,3);//最高点是第三根K时候
con2:=h>refx(h,1) and h>refx(h,2) and h>refx(h,3) and h=hhv(h,2);//最高点是第二根K时
gd:con1 or con2;
con3:=l<refx(l,1) and l<refx(l,2) and l=llv(l,3);//最低是第三根K时候
con4:=l<refx(l,1) and l<refx(l,2) and l<refx(l,3) and l=llv(l,2);///最低点是第二根K时
dd:con3 or con4;
gd_len1:=sumbars(gd,1);
gd_len2:=sumbars(gd,2);
dd_len1:=sumbars(dd,1);
dd_len2:=sumbars(dd,2);
s1:=backset(gd and gd_len2<=dd_len1 and h=hhv(h,BARSSINCE2(gd,dd_len1)+1) ,dd_len1);
s2:=backset(dd and dd_len2<=gd_len1 and l=llv(l,BARSSINCE2(dd,gd_len1)+1) ,gd_len1);
con1:=cross(0.5,s1);
con2:=cross(0.5,s2);
DRAWTEXT(gd,h,'顶',COLORRED,0);
DRAWTEXT(dd,l,'底',COLORGREEN,0);
LEN1:=BARSLAST(refx(con1,1) or (gd and s1=0))+1;//
LEN2:=BARSLAST(refx(con2,1) or (dd and s2=0))+1;//
drawline(refx(con1,1) or (gd and s1=0),h,(refx(con2,1) or (dd and s2=0)),l,0,if(L=llv(l,LEN1),colorred,COLORWHITE));
drawline(refx(con2,1) or (dd and s2=0),l,(refx(con1,1) or (gd and s1=0)),h,0,if(H=HHV(H,LEN2),colorgreen,COLORWHITE));