fh:=high;fl:=low;sell:=0*fh;buy:=sell;signal:=sell;boxh:sell,linethick0;boxl:sell,linethick0;variable:hc=0,lc=0,bt=fh[1],bb=fh[1];for i=1 to datacount do begin if hc>1 then begin if lc>2 and bt<=fh[i] then begin buy[i]:=1; for j=i-1 downto i-hc do begin boxh[j]:=fh[i-hc]; boxl[j]:=fl[i-lc]; end; hc:=0;lc:=0; end; if bt>fh[i] then begin if lc>2 then begin if bb>=fl[i] then begin sell[i]:=1; for j=i-1 downto i-hc do begin boxh[j]:=fh[i-hc]; boxl[j]:=fl[i-lc]; end; hc:=-1;lc:=0; end else begin boxh[i]:=fh[i-hc]; boxl[i]:=fl[i-lc]; end; end; hc:=hc+1; if lc>1 then begin if bb<fl[i] then begin lc:=lc+1; if lc=3 then begin signal[i-hc+1]:=1; for j=i downto i-hc+1 do begin boxh[j]:=fh[i-hc+1]; boxl[j]:=fl[i-lc+1]; end; end; end else lc:=0; end else if lc=1 then begin if bb<fl[i] then begin lc:=lc+1; end else lc:=0; end; if lc=0 and hc>1 then begin bb:=fl[i]; lc:=lc+1; end; end else begin hc:=0; lc:=0; end; end else if hc=1 then begin if bt>fh[i] then hc:=hc+1 else begin hc:=0;lc:=0; end; end; if hc=0 then begin bt:=fh[i]; hc:=hc+1; end;end;partline(boxh and boxh=ref(boxh,1),boxh),coloryellow,pointdot;partline(boxl and boxl=ref(boxl,1),boxl),coloryellow,pointdot;stickline((signal||refx(buy||sell,1))&&boxh,boxh,boxl,0.1,0),pointdot,coloryellow;drawicon(buy,low*0.98,4);drawicon(sell,high*1.02,5); |