ihzx 发表于 2021-8-21 12:51:40

飞狐趋势线(飞狐)

<p>input:N(10,1,88);<br />
DRAWTEXT(SYSPARAM(1)=BARPOS,CLOSE,'改编:hzhengyi'),ALIGN5,LINETHICK4,colorFFFF;<br />
DRAWTEXT(SYSPARAM(1)=BARPOS,CLOSE,'仅供趋势分析用 '),ALIGN4,LINETHICK4,colorFFFF;<br />
V1:=ISLASTBAR;<br />
V2:=REF(HIGH,N)=HHV(HIGH,2*N+1);<br />
V3:=FILTER(V2,N);<br />
V4:=BACKSET(V3,N+1);<br />
V5:=FILTER(V4,N);<br />
V6:=V5 OR V1;<br />
V7:=REF(LOW,N)=LLV(LOW,2*N+1);<br />
V8:=FILTER(V7,N);<br />
V9:=BACKSET(V8,N+1);<br />
VA:=FILTER(V9,N);<br />
VB:=VA AND NOT(V5);<br />
VC:=BACKSET(V6,REF(BARSLAST(VB),1)+1);<br />
VD:=VC&gt;REF(VC,1);<br />
VE:=BACKSET(VD,2);<br />
VF:=VE&gt;REF(VE,1);<br />
V10:=BACKSET(VF AND COUNT(V6,REF(BARSLAST(VB),1)+2)=0,REF(BARSLAST(VB),1)+2);<br />
V11:=V10&gt;REF(V10,1);<br />
V12:=BACKSET(V11 AND COUNT(V6,REF(BARSLAST(VB),1)+2)=0,REF(BARSLAST(VB),1)+2);<br />
V13:=V12&gt;REF(V12,1);<br />
V14:=IF(V6,COUNT(VB,REF(BARSLAST(V6),1)+1),0);<br />
V15:=IF(V14=1 AND V6,BARSLAST(VF),0);<br />
V16:=IF(V6 AND REF(LOW,BARSLAST(VF))&gt;=REF(LOW,BARSLAST(V11)),BARSLAST(V11),BARSLAST(VF));<br />
V17:=IF(V14=2 AND V6,V16,0);<br />
V18:=IF(V14&gt;=3 AND V6,IF(V6 AND REF(LOW,V16)&gt;=REF(LOW,BARSLAST(V13)),BARSLAST(V13),V16),0);<br />
V19:=V15+V17+V18;<br />
V1A:=BACKSET(V6,V19);<br />
V1B:=V1A&gt;REF(V1A,1);<br />
V1C:=BACKSET(V1B,2);<br />
V1D:=V1C&gt;REF(V1C,1);<br />
V1E:=V1D OR V1;<br />
V1F:=BACKSET(V1E,REF(BARSLAST(V6),1)+1);<br />
V20:=V1F&gt;REF(V1F,1);<br />
V21:=BACKSET(V20,2);<br />
V22:=V21&gt;REF(V21,1);<br />
V23:=BACKSET(V22 AND COUNT(V1E,REF(BARSLAST(V6),1)+2)=0,REF(BARSLAST(V6),1)+2);<br />
V24:=V23&gt;REF(V23,1);<br />
V25:=BACKSET(V24 AND COUNT(V1E,REF(BARSLAST(V6),1)+2)=0,REF(BARSLAST(V6),1)+2);<br />
V26:=V25&gt;REF(V25,1);<br />
V27:=IF(V1E,COUNT(V5,REF(BARSLAST(V1E),1)+1),0);<br />
V28:=IF(V27=1 AND V1E,BARSLAST(V22),0);<br />
V29:=IF(V1E AND REF(HIGH,BARSLAST(V22))&lt;=REF(HIGH,BARSLAST(V24)),BARSLAST(V24),BARSLAST(V22));<br />
V2A:=IF(V27=2 AND V1E,V29,0);<br />
V2B:=IF(V27&gt;=3 AND V1E,IF(V1E AND REF(HIGH,V29)&lt;=REF(HIGH,BARSLAST(V26)),BARSLAST(V26),V29),0);<br />
V2C:=V28+V2A+V2B;<br />
V2D:=BACKSET(V1E,V2C);<br />
V2E:=V2D&gt;REF(V2D,1);<br />
V2F:=BACKSET(V2E,2);<br />
V30:=V2F&gt;REF(V2F,1);<br />
DRAWLINE(V1D,LOW,V30,HIGH,0);<br />
DRAWLINE(V30,HIGH,V1D,LOW,0);<br />
V31:=BACKSET(V1,BARSLAST(V1D)+1);<br />
V32:=V31&gt;REF(V31,1);<br />
V33:=BACKSET(V1,BARSLAST(V30)+1);<br />
V34:=V33&gt;REF(V33,1);<br />
V35:=IF(BARSLAST(V32)&lt;BARSLAST(V34),V32,V34);<br />
V36:=IF(BARSLAST(V32)&lt;BARSLAST(V34),LOW,HIGH);<br />
DRAWLINE(V35,V36,V1,CLOSE,0);<br />
V37:=BACKSET(V1,BARSLAST(V1D)+1);<br />
V38:=V37&gt;REF(V37,1);<br />
V39:=BACKSET(V38,REF(BARSLAST(V1D),1)+2);<br />
V3A:=V39&gt;REF(V39,1);<br />
DRAWLINE(V3A,LOW,V38,LOW,1);<br />
V3B:=BACKSET(V1,BARSLAST(V30)+1);<br />
V3C:=V3B&gt;REF(V3B,1);<br />
V3D:=BACKSET(V3C,REF(BARSLAST(V30),1)+2);<br />
V3E:=V3D&gt;REF(V3D,1);<br />
DRAWLINE(V3E,HIGH,V3C,HIGH,1);<br />
前一低: REF(LOW,BARSLAST(V38)),colorccff99,LINEDOT;<br />
前二低: REF(LOW,BARSLAST(V3A)),colormagenta,LINEDOT;<br />
前一高: REF(HIGH,BARSLAST(V3C)),colorccff99;<br />
前二高: REF(HIGH,BARSLAST(V3E)),colormagenta;<br />
{以下语句是大盘指数显示}<br />
A1:=REF(HIGH,3)=HHV(HIGH,2*3+1); B1:=FILTER(A1,3); C1:=BACKSET(B1,3+1); D1:=FILTER(C1,3);{高点}<br />
A2:=REF(LOW,3)=LLV(LOW,2*3+1); B2:=FILTER(A2,3); C2:=BACKSET(B2,3+1); D2:=FILTER(C2,3);{低点}<br />
E1:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2; E2:=(HIGH+LOW)/2;{高低点出现在同一K线上时可作取舍}<br />
H1:=(D1 AND NOT(D2 AND E1&gt;=E2)) OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;<br />
L1:=(D2 AND NOT(D1 AND E1&lt;E2)); H2:=D1 AND NOT(D2 AND E1&gt;=E2);<br />
X1:=REF(BARSLAST(H1),1)+1; F1:=BACKSET(H1 AND COUNT(L1,X1)&gt;0,LLVBARS(IF(L1,LOW,10000),X1));<br />
G1:=F1&gt;REF(F1,1); I1:=BACKSET(G1,2); LD:=I1&gt;REF(I1,1);{过滤后低点}<br />
L2:=LD OR ISLASTBAR OR BARSCOUNT(CLOSE)=1;<br />
X2:=REF(BARSLAST(L2),1)+1; F2:=BACKSET(L2 AND COUNT(H2,X2)&gt;0,HHVBARS(IF(H2,HIGH,0),X2));<br />
G2:=F2&gt;REF(F2,1); I2:=BACKSET(G2,2); HD:=I2&gt;REF(I2,1);{过滤后高点}<br />
UU:=BACKSET(ISLASTBAR,BARSLAST(LD)+1);<br />
VV:=UU&gt;REF(UU,1);<br />
WW:=BACKSET(VV,REF(BARSLAST(LD),1)+2);<br />
XX:=WW&gt;REF(WW,1);<br />
常数1:=REF(INDEXC,BARSLAST(VV))/REF(CLOSE,BARSLAST(VV));<br />
常数2:=REF(INDEXC,BARSLAST(XX))/REF(CLOSE,BARSLAST(XX));<br />
DRAWNUMBER(HD,HIGH*(1+0.002),HIGH,2),COLORff,ALIGN0;<br />
DRAWNUMBER(LD,LOW*(1.001-0.002),LOW,2),COLORff00,ALIGN0;</p>
<p></p>
<p>&nbsp;</p>
页: [1]
查看完整版本: 飞狐趋势线(飞狐)