TY:=L;
A1:=REF(TY,10)=HHV(TY,2*10+1); B1:=FILTER(A1,10); C1:=BACKSET(B1,10+1); HD:=FILTER(C1,10);
A2:=REF(TY,10)=LLV(TY,2*10+1); B2:=FILTER(A2,10); C2:=BACKSET(B2,10+1); LD:=FILTER(C2,10);
前期低位:REF(L,BARSLAST(LD)),COLOR00FF00,POINTDOT;
STICKLINE(L,前期低位,前期低位,8,0),COLORRED;
TZ:=H;
A3:=REF(TY,10)=HHV(TY,2*10+1); B3:=FILTER(A1,10); C3:=BACKSET(B1,10+1); MD:=FILTER(C1,10);
A4:=REF(TY,10)=LLV(TY,2*10+1); B4:=FILTER(A2,10); C4:=BACKSET(B2,10+1); ND:=FILTER(C2,10);
前期高位:REF(H,BARSLAST(MD)),COLOR00FF00,POINTDOT;
STICKLINE(H,前期高位,前期高位,8,0),COLORGREEN;
{精准线}
N:=3;
L0:=1.5;{点位差参数}
{底精准线}
L1:=ABS(L-REF(L,1))<=L0;
L2:=ABS(L-REF(L,2))<=L0;
L3:=ABS(L-REF(L,3))<=L0;
L4:=ABS(L-REF(L,4))<=L0;
L5:=ABS(L-REF(L,5))<=L0;
精准线首次:=L1 OR L2 OR L3 OR L4 OR L5;
精准左:=FILTER(精准线首次,N) ;
天数:=BARSLAST(精准左);
LTS:=REF(L,天数);
精准右:=ABS(L-LTS)<=L0;
STICKLINE(精准左,L,L,50,-1),COLORMAGENTA;
G1:=ABS(H-REF(H,1))<=L0;
G2:=ABS(H-REF(H,2))<=L0;
G3:=ABS(H-REF(H,3))<=L0;
G4:=ABS(H-REF(H,4))<=L0;
G5:=ABS(H-REF(H,5))<=L0;
精准线首次1:=G1 OR G2 OR G3 OR G4 OR G5;
精准左1:=FILTER(精准线首次1,N) ;
天数1:=BARSLAST(精准左1);
HTS:=REF(H,天数1);
精准右1:=ABS(H-HTS)<=L0;
STICKLINE(精准左1,H,H,50,-1),COLORGREEN;
{设立参数:百分比(3,20,5), 右数峰序(2,20,2)}
{ZIG(3,5);}
{百分比:=5};
{右数峰序:=2;}
MA5:=MA(C,5);{HTTP://U.178448.COM/SPACE.PHP?UID=30578}
MA10:=MA(C,10);
MA20:=MA(C,20);
波谷值: CONST(TROUGH(2,百分比,1)),NODRAW;{前M个ZIG转向波谷值}
波谷距离:= 1+CONST(TROUGHBARS(2,百分比,1)),NODRAW;{前M个ZIG转向波谷到当前距离}
{例如:TROUGH(2,5,2)表示%5最低价ZIG转向的前2个波谷到当前的周期数};
波峰值:= CONST(PEAK(1,百分比,右数峰序));
{例如EAK(1,5,1)表示%5最高价ZIG转向的上一个波峰的数值}
XG:= ABS(波峰值-波谷值)<=0.024 {AND BARSCOUNT(V)>60};
波峰距离:= 1+CONST(PEAKBARS(1,百分比,右数峰序)),NODRAW;
{PEAKBARS(K,N,M)表示之字转向ZIG(K,N)的前M个波峰到当前的周期数,M必须大于等于1}
距离:=CURRBARSCOUNT;
DRAWLINE(距离=波峰距离 AND XG,波谷值,距离=1,波谷值,1),COLORMAGENTA;
DRAWTEXT(距离=波谷距离 AND XG,L*0.98,' 峰谷线'),COLORYELLOW;
DRAWICON(距离=波峰距离,H*1.01,2);{波峰位置}
DRAWICON(距离=波谷距离,L*0.985,1);{波谷位置}
精准点:=(ABS(H-波谷值)<=0.024 OR ABS(L-波谷值)<=0.024) {AND 距离<=120};
STICKLINE(精准点,波谷值,波谷值,100,1),COLORYELLOW; |