a1:=ref(h,n)=hhv(h,2*n+1);
b1:=filter(a1,n);
c1:=backset(b1,n+1);
d1:=filter(c1,n);{高点}
a2:=ref(l,n)=llv(l,2*n+1);
b2:=filter(a2,n);
c2:=backset(b2,n+1);
d2:=filter(c2,n);{低点}
e1:=(ref(llv(l,2*n),1)+ref(hhv(h,2*n),1))/2; e2:=(h+l)/2;{高低点出现在同一k线上时可作取舍}
h1:=(d1 and not(d2 and e1>=e2)) or barstatus=2 or barscount(c)=1;
l1:=(d2 and not(d1 and e1<e2)); h2:=d1 and not(d2 and e1>=e2);
x1:=ref(barslast(h1),1)+1; f1:=backset(h1 and count(l1,x1)>0,llvbars
(if(l1,l,10000),x1));
g1:=f1>ref(f1,1); i1:=backset(g1,2); ld:=i1>ref(i1,1);{过滤后低点}
l2:=ld or barstatus=2 or barscount(c)=1;
x2:=ref(barslast(l2),1)+1; f2:=backset(l2 and count(h2,x2)>0,hhvbars
(if(h2,h,0),x2));
g2:=f2>ref(f2,1); i2:=backset(g2,2); hd:=i2>ref(i2,1);{过滤后高点}
r1:=backset(barstatus=2,barslast(hd)+1);
s1:=r1>ref(r1,1); {前一高}
t1:=backset(barstatus=2,barslast(ld)+1);
u1:=t1>ref(t1,1); {前一低}
r2:=backset(s1,ref(barslast(hd),1)+2);
s2:=r2>ref(r2,1); {前二高}
t2:=backset(u1,ref(barslast(ld),1)+2);
u2:=t2>ref(t2,1); {前二低}
短期压力:drawline(s2,h,s1,h,1),colorred;
短期支撑:drawline(u2,l,u1,l,1),colorgreen;var1:=amount/vol;
a:=sma(var1,5,1)-sma(var1,55,1);
b:=sma((a-sma(a,5,1)),5,1);
stickline(close>ma(close,5) and a>ref(a,1) and b>ref(b,1),l,h,0,0),color0000ff;
stickline(close>ma(close,5) and a>ref(a,1) and b>ref(b,1),c,o,2,1),color0000ff;
stickline(cross(close,ma(close,5)) and a>ref(a,1) and b>ref(b,1),c,o,2,0),color0000ff;
stickline(close<ma(close,5) and a>ref(a,1) and b>ref(b,1),l,h,0,0),colorffffff;
stickline(close<ma(close,5) and a>ref(a,1) and b>ref(b,1),c,o,2,1),colorffffff;
前期高位:ref(high,barslast(hd)),color00ff00,pointdot;
前期低位:ref(low,barslast(ld)),colorff00ff,pointdot;
stickline(close,前期高位,前期高位,10,0),color00ff00;
stickline(close,前期低位,前期低位,10,0),colorff00ff;
stickline(a<ref(a,3) and b<ref(b,3),l,h,0,0),color00ff00;
stickline(a<ref(a,3) and b<ref(b,3),c,o,2,1),color00ff00;
stickline(a>ref(a,1) and b<ref(b,1),l,h,0,0),colorffffff;
stickline(a>ref(a,1) and b<ref(b,1),c,o,2,1),colorffffff;
stickline(a<ref(a,1) and b>ref(b,1),l,h,0,0),colorffffff;
stickline(a<ref(a,1) and b>ref(b,1),c,o,2,1),colorffffff; |