飞狐顾比倒数主图指标公式股票软件源码如下: ff:=l; fhf:=h; fgf:=h; ftf:=l; fdf:=l; zdtf:=c; zqf:=c; zqtf:=c; {顾比倒数进场} <% f=ffl.vardata("ff") fh=ffl.vardata("fhf") fg=ffl.vardata("fgf") ft=ffl.vardata("ftf") fd=ffl.vardata("fdf") zq=ffl.vardata("zqf") zqt=ffl.vardata("zqtf") zdt=ffl.vardata("zdtf") zq(1)=0 zq(2)=0 zqt(1)=0 zqt(2)=0 tj=0 n=ubound(f) for i=2 to n k1=0 k2=0 k3=0 ii=i-2 for j=ii to 2 step -1 if f(j)k1=j exit for end if next j=k1-1 while j>=0 and tj=0 if fh(j)>fh(k1) then k2=j tj=1 else j=j-1 end if wend j=k2-1 tj=0 while j>=0 and tj=0 if fh(j)>fh(k2) then k3=j tj=1 else j=j-1 end if wend
if k3>0 then fg(i)=fh(k3) zq(i)=k3 else fg(i)=fg(i-1) zq(i)=zq(i-1)+1 end if next ffl.vardata("fgf")=fg ffl.vardata("zqf")=zq '止损线' for i=2 to n k1=0 k2=0 k3=0 ii=i-2 for j=ii to 2 step -1 if fh(j)>fh(j-1) and fh(j)>fh(j-2) and fh(j)>fh(j+1) and fh(j)>fh(j+2) then k1=j exit for end if next tj=0 j=k1-1 while j>=0 and tj=0 if fh(j)k2=j tj=1 else j=j-1 end if wend if k2>0 then fd(i)=fh(k2) zdt(i)=k2 else fd(i)=fd(i-1) zdt(i)=zdt(i-1)+1 end if j=k2-1 tj=0 while j>0 and tj=0 if fh(j)k3=j tj=1 else j=j-1 end if wend if k3>0 then ft(i)=fh(k3) zqt(i)=k3 else ft(i)=ft(i-1) zq(i)=zqt(i-1)+1 end if next ffl.vardata("ftf")=ft ffl.vardata("fdf")=fd ffl.vardata("zqtf")=zqt ffl.vardata("zdtf")=zdt %> 止赢线:ftf,linethick1,colorwhite,LINEDOT;//如果想把止损位提高,可选第二根K线做参考线,把ftf改成fdf就可以了; 顾比倒数:fgf,COLORCYAN,LINEDOT; |