获利盘%:WINNER(CLOSE)*100,NODRAW,COLORRED;
波段线:=zig(2,4),COLORWHITE;
涨天数:BArslASTCOUNT(波段线>REF(波段线,1)),NODRAW,COLORFF00FF;
VAR111:=(C-REF(C,涨天数))/REF(C,涨天数)*100;
涨幅%:IF(涨天数>0,VAR111, DRAWNULL),NODRAW,COLORFF00FF;
跌天数:BARSLASTCOUNT(波段线<REF(波段线,1)),NODRAW,COLORWHITE;
VAR211:=(C-REF(C,跌天数))/REF(C,跌天数)*100;
跌幅%:IF(跌天数>0,VAR211, DRAWNULL),NODRAW,COLORWHITE;
汉边:(COST(99)+COST(93)+COST(85))/3,COLORBLUE,DOTLINE,LINETHICK1;
汉界:(COST(84)+COST(67)+COST(50))/3,COLORBLUE,DOTLINE,LINETHICK1;
楚河:(COST(16)+COST(34)+COST(49))/3,COLORGRAY,DOTLINE,LINETHICK1;
楚边:(COST(1)+COST(7)+COST(15))/3,COLORGRAY,DOTLINE,LINETHICK1;
汉界飘移:(汉界-REF(汉界,3))/REF(汉界,3)*100,COLORGREEN,NODRAW;
楚河飘移:(楚河-REF(楚河,3))/REF(楚河,3)*100,COLORRED,NODRAW;
STICKLINE(18,楚河,楚边,5,0),COLOR222222;
STICKLINE(18,汉边,汉界,5,0),COLORBLUE;
DRAWKLINE(HIGH,OPEN,LOW,CLOSE);
绿60:MA(C,60),COLORGREEN,LINETHICK2;
{macd叉叉}
DIFF:=( EMA(CLOSE,12) - EMA(CLOSE,26)),COLORWHITE;
DEA:=EMA(DIFF,9),COLORF00FF0 ;
MacD:=0.90*(DIFF-DEA), COLORSTICK;
TJ0:=DIFF>=DEA;
TJ01:=DIFF>=0;
STICKLINE(TJ0,H,L,0,0),COLORMAGENTA;
STICKLINE(TJ0,O,C,2.5,0),COLORMAGENTA;
STICKLINE( TJ01 AND TJ0,H,L,0,0 ),COLORRED;
STICKLINE( TJ01 AND TJ0,O,C,2.5,0 ),COLORRED;
STICKLINE(DIFF<DEA,H,L,0,0),COLORWHITE;
STICKLINE(DIFF<DEA,O,C,2.5,0),COLORWHITE;
STICKLINE(TJ01 AND DIFF<DEA,O,C,2.5,0),COLORCYAN;
STICKLINE(TJ01 AND DIFF<DEA,H,L,0,0),COLORCYAN;
{划线}
{N1:1,100,10;N2:1,100,10;DISP:=1,3,2};
N1:=10;N2:=10;DISP:=2;
K:=IF(PERIOD=5,1,{日}
IF(PERIOD=6,1,{周}
IF(PERIOD=7,1,{月}
IF(PERIOD=8,1,{多分钟}
IF(PERIOD=9,1,{多日}
IF(PERIOD=10,1,{季}
IF(PERIOD=11,2,{年}
IF(PERIOD=4,1,{60F}
IF(PERIOD=3,1,{30F}
IF(PERIOD=2,1,{15F}
IF(PERIOD=1,1{5F},1{1F})))))))))))/10;
P1:=PEAK(1,K*N1,1);
P2:=PEAK(1,K*N1,2);
WP1:=PEAKBARS(1,K*N1,1);
WP2:=PEAKBARS(1,K*N1,2);
T1:=TROUGH(2,K*N2,1);
T2:=TROUGH(2,K*N2,2);
WT1:=TROUGHBARS(2,K*N2,1);
WT2:=TROUGHBARS(2,K*N2,2);
TJ1:=P1>T1 AND P2>T2 ;
ZD:=MAX(T1,T2);
ZG:=MIN(P1,P2);
LL:=MIN(T1,T2);
HH:=MAX(P1,P2);
TJ2:=FILTER(ZG>ZD,2);
TJ3:=ZG=REF(ZG,BARSLAST(TJ2)) OR ZD=REF(ZD,BARSLAST(TJ2));
TJ4:=TJ1&&TJ2&&NOT(TJ3);
TJ5:=BETWEEN(ZD,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1)));
TJ6:=BETWEEN(ZG,REF(ZD,REF(BARSLAST(TJ4),1)),REF(ZG,REF(BARSLAST(TJ4),1)));
TJ7:=ZG>REF(ZG,REF(BARSLAST(TJ4),1))&&ZD<REF(ZD,REF(BARSLAST(TJ4),1));
TJ8:=TJ4&&NOT(TJ5 OR TJ6 OR TJ7);
ZSD:=IF(TJ8,ZD,DRAWNULL);
ZSG:=IF(TJ8,ZG,DRAWNULL);
ZSH:=IF(TJ8,HH,DRAWNULL);
ZSL:=IF(TJ8,LL,DRAWNULL);
{STICKLINE(TJ8,ZSH,ZSL,0,-1),COLORMAGENTA;
STICKLINE(TJ8,ZSD,ZSG,IF(DISP=1,3,0),1),COLORMAGENTA;
DRAWTEXT(DISP=2,ZSH,'中枢'),COLORWHITE;}
中枢高:=PLOYLINE(DISP=2,REF(ZSD,BARSLAST(TJ8))),POINTDOT,COLORLIRED,LINETHICK1;
中枢低:=PLOYLINE(DISP=2,REF(ZSG,BARSLAST(TJ8))),POINTDOT,COLORLIGREEN,LINETHICK1;
中枢最高:=PLOYLINE(DISP=2,REF(ZSH,BARSLAST(TJ8))),crOSSDOT,COLORRED,LINETHICK1;
中枢最低:=PLOYLINE(DISP=2,REF(ZSL,BARSLAST(TJ8))),CROSSDOT,COLORGREEN,LINETHICK1;
趋势高:=PLOYLINE(DISP=3,ZIG(1,K*N1)),COLORLIBLUE;
趋势低:=PLOYLINE(DISP=3,ZIG(2,K*N2)),COLORLIBLUE;
局部低点预选A:=BACKSET(LLV(L,5)<REF(LLV(L,4),1),4);
局部低点预选B:=BACKSET(局部低点预选A=0 AND REF(局部低点预选A,1)=1,2);
局部低点预选C:=IF(局部低点预选B=1 AND REF(局部低点预选B,1)=0,-1,0);
局部高点预选A:=BACKSET(HHV(H,5)>REF(HHV(H,4),1),4);
局部高点预选B:=BACKSET(局部高点预选A=0 AND REF(局部高点预选A,1)=1,2);
局部高点预选C:=IF(局部高点预选B=1 AND REF(局部高点预选B,1)=0,1,0);
缺口判断:=IF(L>REF(H,1),1,IF(H<REF(L,1),-1,0));
距前高天:=BARSLAST(局部高点预选C=1);
距前低天:=BARSLAST(局部低点预选C=-1);
小值周期:=LOwrANGE(L);
大值周期:=topRANGE(H);
低保留AA:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);
低保留AB:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR LLV(L,距前低天+2)<REF(LLV(L,距前低天+1),1)),-1,0);
低保留S:=IF((低保留AA=-1 OR 低保留AB=-1) AND L<REF(H,距前高天+1),-1,0);
预判:=IF((距前低天<4 AND HHV(缺口判断,距前低天)!=1) OR REF(低保留S,距前低天)=0,1,0);
判断:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND 预判=1 AND 大值周期>REF(小值周期,距前低天+1) AND 大值周期>REF(小值周期,距前低天) AND 大值周期>REF(大值周期,距前高天),1,0);
高保留A:=IF(局部高点预选C=1 AND REF(距前低天,1)>REF(距前高天,1) AND HHV(H,距前低天+1)>REF(HHV(H,距前低天+1),1),1,0);
高保留B:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) AND REF(低保留S,距前低天)=-1 AND (距前低天>=4 OR HHV(缺口判断,距前低天)=1),1,0);
高保留:=IF((高保留A=1 OR 高保留B=1 OR 判断=1) AND H>REF(L,距前低天+1),1,0);
预判A:=IF((距前高天<4 AND HHV(缺口判断,距前高天)!=1) OR REF(高保留,距前高天)=0,1,0);
判断A:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND 预判A=1 AND 小值周期>REF(大值周期,距前高天+1) AND 小值周期>REF(大值周期,距前高天) AND 小值周期>REF(小值周期,距前低天),-1,0);
低保留A:=IF(局部低点预选C=-1 AND REF(距前高天,1)>REF(距前低天,1) AND LLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);
低保留B:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1) AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 OR 判断A=-1),-1,0);
低保留:=IF((低保留A=-1 OR 低保留B=-1) AND L<REF(H,距前高天+1),-1,0);
距前高天A:=BARSLAST(高保留=1);
距前低天A:=BARSLAST(低保留=-1);
预判X:=IF((距前低天A<4 AND HHV(缺口判断,距前低天A)!=1) OR REF(低保留,距前低天A)=0,1,0);
判断X:=IF(局部高点预选C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND 预判X=1 AND 大值周期>REF(小值周期,距前低天A+1) AND 大值周期>REF(小值周期,距前低天A) AND 大值周期>REF(大值周期,距前高天A),1,0);
高保留XA:=IF(局部高点预选C=1 AND REF(距前低天A,1)>REF(距前高天A,1) AND HHV(H,距前低天A+1)>REF(HHV(H,距前低天A+1),1),1,0);
高保留XB:=IF(局部高点预选C=1 AND REF(距前低天A,1)<=REF(距前高天A,1) AND REF(低保留,距前低天A)=-1 AND (距前低天A>=4 OR HHV(缺口判断,距前低天A)=1),1,0);
高保留X:=IF((高保留XA=1 OR 高保留XB=1 OR 判断X=1) AND H>REF(L,距前低天A+1),1,0);
预判XA:=IF((距前高天A<4 AND HHV(缺口判断,距前高天A)!=1) OR REF(高保留XA,距前高天A)=0,1,0);
判断XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND 预判XA=1 AND 小值周期>REF(大值周期,距前高天A+1) AND 小值周期>REF(大值周期,距前高天A) AND 小值周期>REF(小值周期,距前低天A),-1,0);
低保留XA:=IF(局部低点预选C=-1 AND REF(距前高天A,1)>REF(距前低天A,1) AND LLV(L,距前高天A+1)<REF(LLV(L,距前高天A+1),1),-1,0);
低保留XB:=IF(局部低点预选C=-1 AND REF(距前高天A,1)<=REF(距前低天A,1) AND (距前高天A>=4 OR LLV(缺口判断,距前高天A)=-1 OR 判断XA=-1),-1,0);
低保留X:=IF((低保留XA=-1 OR 低保留XB=-1) AND L<REF(H,距前高天A+1),-1,0);
距前高天YA:=BARSLAST(高保留X=1);
距前低天YA:=BARSLAST(低保留X=-1);
预判YX:=IF((距前低天YA<4 AND HHV(缺口判断,距前低天YA)!=1) OR REF(低保留X,距前低天YA)=0,1,0);
判断YX:=IF(局部高点预选C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND 预判YX=1 AND 大值周期>REF(小值周期,距前低天YA+1) AND 大值周期>REF(小值周期,距前低天YA) AND 大值周期>REF(大值周期,距前高天YA),1,0);
高保留YXA:=IF(局部高点预选C=1 AND REF(距前低天YA,1)>REF(距前高天YA,1) AND HHV(H,距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0);
高保留YXB:=IF(局部高点预选C=1 AND REF(距前低天YA,1)<=REF(距前高天YA,1) AND REF(低保留X,距前低天YA)=-1 AND (距前低天YA>=4 OR HHV(缺口判断,距前低天YA)=1),1,0);
高保留YX:=IF((高保留YXA=1 OR 高保留YXB=1 OR 判断YX=1) AND H>REF(L,距前低天YA+1),1,0);
预判YXA:=IF((距前高天YA<4 AND HHV(缺口判断,距前高天YA)!=1) OR REF(高保留YXA,距前高天YA)=0,1,0);
判断YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND 预判YXA=1 AND 小值周期>REF(大值周期,距前高天YA+1) AND 小值周期>REF(大值周期,距前高天YA) AND 小值周期>REF(小值周期,距前低天YA),-1,0);
低保留YXA:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)>REF(距前低天YA,1) AND LLV(L,距前高天YA+1)<REF(LLV(L,距前高天YA+1),1),-1,0);
低保留YXB:=IF(局部低点预选C=-1 AND REF(距前高天YA,1)<=REF(距前低天YA,1) AND (距前高天YA>=4 OR LLV(缺口判断,距前高天YA)=-1 OR 判断YXA=-1),-1,0);
低保留YX:=IF((低保留YXA=-1 OR 低保留YXB=-1) AND L<REF(H,距前高天YA+1),-1,0);
AAAD:=IF(高保留YX=1 AND 低保留YX=-1 AND H>REF(H,REF(距前高天YA,1)+2),1,IF(高保留YX=1 AND 低保留YX=-1 AND L<REF(L,REF(距前低天YA,1)+2),-1,0));
极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD);
局部极点:=IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL)) POINTDOT COLORYELLOW,LINETHICK2;
DD1111:=BARSLAST(Abs(极点保留)!=1);
顶周期:=TOPRANGE(H);底周期:=LOWRANGE(L);
上内:=LLVBARS(H,顶周期);上外:=LLVBARS(L,顶周期);
下内:=HHVBARS(L,底周期);下外:=HHVBARS(H,底周期);
上力度:=HHV(L,上内+1)>LLV(H,上内+1);
下力度:=HHV(L,下内+1)>LLV(H,下内+1);
上包含:=COUNT(L>=REF(L,1),上外)>2 AND COUNT(H>=REF(H,1),上内)>2;
下包含:=COUNT(H<=REF(H,1),下外)>2 AND COUNT(L<=REF(L,1),下内)>2;
顶0:=顶周期 AND 上力度 AND 上包含 AND 上外>3;
底0:=底周期 AND 下力度 AND 下包含 AND 下外>3;
顶分天数:=BARSLAST(顶0);
底分天数:=BARSLAST(底0);
含中间k线:=IF(顶分天数=0,底分天数,顶分天数)>=3;
顶:=顶0 AND 含中间K线 AND H=HHV(H,BARSLAST(底0));
底:=底0 AND 含中间K线 AND L=LLV(L,BARSLAST(顶0));
顶2:=顶0 AND 含中间K线 AND H=HHV(H,BARSLAST(底0));
底2:=底0 AND 含中间K线 AND L=LLV(L,BARSLAST(顶0));
低点点:=底2,H<顶2,L;
NOTEXT上笔划线:DRAWLINE(底2 AND 低点点,L,顶2,H,0)DOTLINE,COLORGREEN,LINETHICK1;
NOTEXT下笔划线:DRAWLINE(顶2,H,底2,L,0)DOTLINE,COLORGREEN,LINETHICK1;
中轨:MA(CLOSE,20),COLORRED,LINETHICK2;
UPPE:中轨 + 2*STD(CLOSE,22)COLOR555555,LINETHICK1;
LOWE:中轨 - 2*STD(CLOSE,22)COLOR555555,LINETHICK1;
A1:=BARSLAST(REF(CROSS(DIFF,DEA),1));
A22:=BARSLAST(REF(CROSS(DEA,DIFF),1));
底背离:=REF(CLOSE,A1+1)>CLOSE AND DIFF>REF(DIFF,A1+1) AND CROSS(DIFF,DEA);
顶背离:=REF(CLOSE,A22+1)<CLOSE AND REF(DIFF,A22+1)>DIFF AND CROSS(DEA,DIFF);
DRAWTEXT(底背离,L,'←背'),COLORRED;
DRAWTEXT(顶背离,H*1.005,'←背'),COLORGREEN;
STICKLINE( 底背离,HIGH,LOW,0,1 ),COLORRED;
STICKLINE(底背离,OPEN,CLOSE,3,0 ),COLOR000077;
STICKLINE( 底背离,OPEN,CLOSE,2.1,0 ),COLOR000099;
STICKLINE( 底背离,OPEN,CLOSE,1.5,0 ),COLOR0000BB;
STICKLINE( 底背离,OPEN,CLOSE,0.9,0 ),COLOR0000DD;
STICKLINE( 底背离,OPEN,CLOSE,0.3,0 ),COLOR0000FF;
STICKLINE(顶背离,O,C,3,0),COLOR770000;
STICKLINE(顶背离,O,C,2.1,0),COLORAA3300;
STICKLINE(顶背离,O,C,1.5,0),COLORDD6600;
STICKLINE(顶背离,O,C,0.5,0),COLORFF8800;
现价: PLOYLINE(1,CONST(C)),POINTDOT,COLORWHITE;
DRAWNUMBER(CURRBARSCOUNT=25,现价,现价),COLORWHITE;
DRAWTEXT(CURRBARSCOUNT=100,现价*1.018,'飘移正值突变(大于5)底部锁仓筹码正在快速上移派'),COLORRED;
DRAWTEXT(CURRBARSCOUNT=100,现价*0.95,'飘移负值突变(低于-5)顶部套牢筹码正在快速下移割肉'),COLORWHITE;
DRAWTEXT_FIX(1,0.00,0.06,0,DYBLOCK)COLORGREEN;
A5:MA(C,N1),COLORYELLOW;