n:=14;
限制:=1;
A6a:=REF(HIGH,6)=HHV(HIGH,2*6+1);
B6a:=FILTER(A6a,6);
C6a:=BACKSET(B6a,6+1);
D6a:=FILTER(C6a,6);
A7a:=REF(LOW,6)=LLV(LOW,2*6+1);
B7a:=FILTER(A7a,6);
C7a:=BACKSET(B7a,6+1);
D7a:=FILTER(C7a,6);
E6a:=(REF(LLV(LOW,2*6),1)+REF(HHV(HIGH,2*6),1))/2;
E7a:=(HIGH+LOW)/2;
H6a:=(D6a AND NOT(D7a AND E6a =E7a)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
H7a:=D6a AND NOT(D7a AND E6a =E7a);
L6a:=D7a AND NOT(D6a AND E6a=E7a);
X6a:=REF(BARSLAST(H6a),1)+1;
F6a:=BACKSET(H6a AND COUNT(L6a,X6a) 0,LLVBARS(IF(L6a,LOW,10000),X6a));
G6a:=F6a REF(F6a,1);
I6a:=BACKSET(G6a,2);
LD2a:=I6a REF(I6a,1);
L7a:=LD2a OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
X7a:=REF(BARSLAST(L7a),1)+1;
F7a:=BACKSET(L7a AND COUNT(H7a,X7a) 0,HHVBARS(IF(H7a,HIGH,0),X7a));
G7a:=F7a REF(F7a,1);
I7a:=BACKSET(G7a,2);
HD2a:=I7a REF(I7a,1);
UU3a:=BACKSET(BARSTATUS=2,BARSLAST(LD2a)+1);
VV3a:=UU3a REF(UU3a,1);
WW3a:=BACKSET(VV3a,REF(BARSLAST(LD2a),1)+2);
XX3a:=WW3a REF(WW3a,1);
DRAWLINE(XX3a and 限制,L,VV3a and 限制,L,1),Color800040;
UU4a:=BACKSET(BARSTATUS=2,BARSLAST(HD2a)+1);
VV4a:=UU4a REF(UU4a,1);
WW4a:=BACKSET(VV4a,REF(BARSLAST(HD2a),1)+2);
XX4a:=WW4a REF(WW4a,1);
DRAWLINE(XX4a and 限制,H,VV4a and 限制,H,1),Color800040;
A6b:=REF(HIGH,3)=HHV(HIGH,2*3+1);
B6b:=FILTER(A6b,3);
C6b:=BACKSET(B6b,3+1);
D6b:=FILTER(C6b,3);
A7b:=REF(LOW,3)=LLV(LOW,2*3+1);
B7b:=FILTER(A7b,3);
C7b:=BACKSET(B7b,3+1);
D7b:=FILTER(C7b,3);
E6b:=(REF(LLV(LOW,2*3),1)+REF(HHV(HIGH,2*3),1))/2;
E7b:=(HIGH+LOW)/2;
H6b:=(D6b AND NOT(D7b AND E6b =E7b)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
H7b:=D6b AND NOT(D7b AND E6b =E7b);
L6b:=D7b AND NOT(D6b AND E6b=E7b);
X6b:=REF(BARSLAST(H6b),1)+1;
F6b:=BACKSET(H6b AND COUNT(L6b,X6b) 0,LLVBARS(IF(L6b,LOW,10000),X6b));
G6b:=F6b REF(F6b,1);
I6b:=BACKSET(G6b,2);
LD2b:=I6b REF(I6b,1);
L7b:=LD2b OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
X7b:=REF(BARSLAST(L7b),1)+1;
F7b:=BACKSET(L7b AND COUNT(H7b,X7b) 0,HHVBARS(IF(H7b,HIGH,0),X7b));
G7b:=F7b REF(F7b,1);
I7b:=BACKSET(G7b,2);
HD2b:=I7b REF(I7b,1);
UU3b:=BACKSET(BARSTATUS=2,BARSLAST(LD2b)+1);
VV3b:=UU3b REF(UU3b,1);
WW3b:=BACKSET(VV3b,REF(BARSLAST(LD2b),1)+2);
XX3b:=WW3b REF(WW3b,1);
DRAWLINE(XX3b and 限制,L,VV3b and 限制,L,1),Color009090;
UU4b:=BACKSET(BARSTATUS=2,BARSLAST(HD2b)+1);
VV4b:=UU4b REF(UU4b,1);
WW4b:=BACKSET(VV4b,REF(BARSLAST(HD2b),1)+2);
XX4b:=WW4b REF(WW4b,1);
DRAWLINE(XX4b and 限制,H,VV4b and 限制,H,1),COLOR888888;
A6e:=REF(HIGH,13)=HHV(HIGH,2*13+1);
B6e:=FILTER(A6e,13);
C6e:=BACKSET(B6e,13+1);
D6e:=FILTER(C6e,13);
A7e:=REF(LOW,13)=LLV(LOW,2*13+1);
B7e:=FILTER(A7e,13);
C7e:=BACKSET(B7e,13+1);
D7e:=FILTER(C7e,13);{低点}
E6e:=(REF(LLV(LOW,2*13),1)+REF(HHV(HIGH,2*13),1))/2;
E7e:=(HIGH+LOW)/2;
H6e:=(D6e AND NOT(D7e AND E6e =E7e)) OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
H7e:=D6e AND NOT(D7e AND E6e =E7e);
L6e:=D7e AND NOT(D6e AND E6e=E7e);
X6e:=REF(BARSLAST(H6e),1)+1;
F6e:=BACKSET(H6e AND COUNT(L6e,X6e) 0,LLVBARS(IF(L6e,LOW,10000),X6e));
G6e:=F6e REF(F6e,1);
I6e:=BACKSET(G6e,2);
LD2e:=I6e REF(I6e,1);
L7e:=LD2e OR BARSTATUS=2 OR BARSCOUNT(CLOSE)=1;
X7e:=REF(BARSLAST(L7e),1)+1;{www.9m8.cn 九毛八公式指标网}
F7e:=BACKSET(L7e AND COUNT(H7e,X7e) 0,HHVBARS(IF(H7e,HIGH,0),X7e));
G7e:=F7e REF(F7e,1);
I7e:=BACKSET(G7e,2);
HD2e:=I7e REF(I7e,1);
UU3e:=BACKSET(BARSTATUS=2,BARSLAST(LD2e)+1);
VV3e:=UU3e REF(UU3e,1);
WW3e:=BACKSET(VV3e,REF(BARSLAST(LD2e),1)+2);
XX3e:=WW3e REF(WW3e,1);
DRAWLINE(XX3e and 限制,L,VV3e and 限制,L,1),Colorred;
UU4e:=BACKSET(BARSTATUS=2,BARSLAST(HD2e)+1);
VV4e:=UU4e REF(UU4e,1);
WW4e:=BACKSET(VV4e,REF(BARSLAST(HD2e),1)+2);
XX4e:=WW4e REF(WW4e,1);
DRAWLINE(XX4e and 限制,H,VV4e and 限制,H,1),Colorgreen;
AW1:=ref(h,N)=hhv(h,2*N+1);
BW1:=filter(AW1,N);
CW1:=backset(BW1,N+1);
DW1:=filter(CW1,n);{高点}
AW2:=ref(l,N)=llv(l,2*N+1);
BW2:=filter(AW2,N);
CW2:=backset(BW2,N+1);
DW2:=filter(CW2,N);{低点}
EW1:=(ref(llv(l,2*N),1)+ref(hhv(h,2*N),1))/2;
EW2:=(h+l)/2;{高低点出现在同一K线上时可作取舍}
HW1:=(DW1 AND not(DW2 AND EW1 =EW2)) OR barstatus=2 OR barscount(c)=1;
LW1:=(DW2 AND not(DW1 AND EW1 EW2));
HW2:=DW1 AND not(DW2 AND EW1 =EW2);
XW1:=ref(barslast(HW1),1)+1;
FW1:=backset(HW1 AND count(LW1,XW1) 0,llvbars(if(LW1,l,10000),XW1));
GW1:=FW1 ref(FW1,1);
IW1:=backset(GW1,2);
LDW:=IW1 ref(IW1,1);{过滤后低点}
LW2:=LDW OR barstatus=2 OR barscount(c)=1;
XW2:=ref(barslast(LW2),1)+1;
FW2:=backset(LW2 AND count(HW2,XW2) 0,hhvbars(if(HW2,h,0),XW2));
GW2:=FW2 ref(FW2,1);
IW2:=backset(GW2,2);
HDW:=IW2 ref(IW2,1);{过滤后高点}
RW1:=backset(barstatus=2,barslast(HDW)+1);
SW1:=RW1 ref(RW1,1); {前一高}
TW1:=backset(barstatus=2,barslast(LDW)+1);
UW1:=TW1 ref(TW1,1); {前一低}
RW2:=backset(SW1,ref(barslast(HDW),1)+2);
SW2:=RW2 ref(RW2,1); {前二高}
TW2:=backset(UW1,ref(barslast(LDW),1)+2);
UW2:=TW2 ref(TW2,1); {前二低}
RW3:=backset(SW2,ref(barslast(HDW),1)+2);
SW3:=RW3 ref(RW3,1); {前三高}
TW3:=backset(UW2,ref(barslast(LDW),1)+2);
UW3:=TW3 ref(TW3,1); {前三低}
RW4:=backset(SW3,ref(barslast(HDW),1)+2);
SW4:=RW4 ref(RW4,1); {前四高}
TW4:=backset(UW3,ref(barslast(LDW),1)+2);
UW4:=TW4 ref(TW4,1); {前四低}
RW5:=backset(SW4,ref(barslast(HDW),1)+2);
SW5:=RW5 ref(RW5,1); {前五高}
TW5:=backset(UW4,ref(barslast(LDW),1)+2);
UW5:=TW5 ref(TW5,1); {前五低}
RW6:=backset(SW5,ref(barslast(HDW),1)+2);