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SG,IF(DISP=1,3,0),1),COLORMAGENTA;
DRAWTEXT(DISP=2,ZSH,'中枢'),COLORRED;
中枢高:PLOYLINE(DISP=2,REF(ZSD,BARSLAST(TJ8))),CROSSDOT,COLORLIRED;
中枢低:PLOYLINE(DISP=2,REF(ZSG,BARSLAST(TJ8))),CROSSDOT,COLORLIGREEN;
中枢最高:PLOYLINE(DISP=2,REF(ZSH,BARSLAST(TJ8))),POINTDOT,COLORRED;
中枢最低:PLOYLINE(DISP=2,REF(ZSL,BARSLAST(TJ8))),POINTDOT,COLORGREEN;
趋势高: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) ANDLLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);
低保留AB:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1)AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 ORLLV(L,距前低天+2)<REF(LLV(L,距前低天+1),1)),-1,0);
低保留S:=IF((低保留AA=-1 OR 低保留AB=-1) ANDL<REF(H,距前高天+1),-1,0);
预判:=IF((距前低天<4 AND HHV(缺口判断,距前低天)!=1) ORREF(低保留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) ANDHHV(H,距前低天+1)>REF(HHV(H,距前低天+1),1),1,0);
高保留B:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) ANDREF(低保留S,距前低天)=-1 AND (距前低天>=4 ORHHV(缺口判断,距前低天)=1),1,0);
高保留:=IF((高保留A=1 OR 高保留B=1 OR 判断=1) ANDH>REF(L,距前低天+1),1,0);
预判A:=IF((距前高天<4 AND HHV(缺口判断,距前高天)!=1) ORREF(高保留,距前高天)=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) ANDLLV(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) ANDL<REF(H,距前高天+1),-1,0);
距前高天A:=BARSLAST(高保留=1);
距前低天A:=BARSLAST(低保留=-1);
预判X:=IF((距前低天A<4 AND HHV(缺口判断,距前低天A)!=1) ORREF(低保留,距前低天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 ORHHV(缺口判断,距前低天A)=1),1,0);
高保留X:=IF((高保留XA=1 OR 高保留XB=1 OR 判断X=1) ANDH>REF(L,距前低天A+1),1,0);
预判XA:=IF((距前高天A<4 AND HHV(缺口判断,距前高天A)!=1) ORREF(高保留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)ANDLLV(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) ANDL<REF(H,距前高天A+1),-1,0);
距前高天YA:=BARSLAST(高保留X=1);
距前低天YA:=BARSLAST(低保留X=-1);
预判YX:=IF((距前低天YA<4 AND HHV(缺口判断,距前低天YA)!=1) ORREF(低保留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)ANDHHV(H,距前低天YA+1)>REF(HHV(H,距前低天YA+1),1),1,0);
高保留YXB:=IF(局部高点预选C=1 ANDREF(距前低天YA,1)<=REF(距前高天YA,1) AND REF(低保留X,距前低天YA)=-1AND (距前低天YA>=4 OR HHV(缺口判断,距前低天YA)=1),1,0);
高保留YX:=IF((高保留YXA=1 OR 高保留YXB=1 OR 判断YX=1) ANDH>REF(L,距前低天YA+1),1,0);
预判YXA:=IF((距前高天YA<4 AND HHV(缺口判断,距前高天YA)!=1) ORREF(高保留YXA,距前高天YA)=0,1,0);
判断YXA:=IF(局部低点预选C=-1 ANDREF(距前高天YA,1)<=REF(距前低天YA,1) AND 预判YXA=1 AND小值周期>REF(大值周期,距前高天YA+1) AND小值周期>REF(大值周期,距前高天YA) AND小值周期>REF(小值周期,距前低天YA),-1,0);
低保留YXA:=IF(局部低点预选C=-1 ANDREF(距前高天YA,1)>REF(距前低天YA,1) ANDLLV(L,距前高天YA+1)<REF(LLV(L,距前高天YA+1),1),-1,0);
低保留YXB:=IF(局部低点预选C=-1 ANDREF(距前高天YA,1)<=REF(距前低天YA,1) AND(距前高天YA>=4 OR LLV(缺口判断,距前高天YA)=-1 OR判断YXA=-1),-1,0);
低保留YX:=IF((低保留YXA=-1 OR 低保留YXB=-1) ANDL<REF(H,距前高天YA+1),-1,0);
AAAD:=IF(高保留YX=1 AND 低保留YX=-1 ANDH>REF(H,REF(距前高天YA,1)+2),1,IF(高保留YX=1 AND 低保留YX=-1AND L<REF(L,REF(距前低天YA,1)+2),-1,0));
极点保留:=IF(AAAD=0,高保留YX+低保留YX,AAAD);
局部极点:IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL)) CIRCLEDOTCOLORYELLOW;
DRAWLINE(极点保留=-1,局部极点,极点保留=1,局部极点,0)COLORLIRED;
DRAWLINE(极点保留=1,局部极点,极点保留=-1,局部极点,0)COLORYELLOW;
DD1:=BARSLAST(ABS(极点保留)!=1);
DRAWTEXT(极点保留=1,局部极点,'*'),COLORGREEN;
DRAWTEXT(极点保留=-1,局部极点,'*'),COLORRED;
MA5:MA(CLOSE,5),COLORFF00FF,LINETHICK1;{判:IF(MA5<REF(MA5,1),MA5,DRAWNULL),COLORWHITE,LINETHICK2;};
{笔底分型__ 确保向下笔成立后的底分型}
重心线:(H+L+O+C*3)/6;
NX:=(3*CLOSE+LOW+OPEN+HIGH)/6;
牛线:=(20*NX+19*REF(NX,1)+18*REF(NX,2)+17*REF(NX,3)+16*REF(NX,4)
+15*REF(NX,5)+14*REF(NX,6)+13*REF(NX,7)+12*REF(NX,8)+11*REF(NX,9)
+10*REF(NX,10)+9*REF(NX,11)+8*REF(NX,12)+7*REF(NX,13)+6*REF(NX,14)
+5*REF(NX,15)+4*REF(NX,16)+3*REF(NX,17)
+2*REF(NX,18)+REF(NX,20))/210;
牛熊线:MA(牛线,6),COLORGREEN,LINETHICK2;
简底:=H>REF(H,1) AND REF(H,1)<REF(H,2)AND L>REF(L,1) ANDREF(L,1)<REF(L,2);
简顶:=H<REF(H,1) AND REF(H,1)>REF(H,2)AND L<REF(L,1) ANDREF(L,1)>REF(L,2);
包含1:=REF(H,1)>=REF(H,2) ANDREF(L,1)<=REF(L,2);
包含2:=REF(H,1)<=REF(H,2) ANDREF(L,1)>=REF(L,2);
包底1:=H>REF(H,2) AND REF(H,2)<REF(H,3)AND L>REF(L,1) ANDREF(L,1)<REF(L,3);
包底2:=H>REF(H,1) AND REF(H,1)<REF(H,3)AND L>REF(L,2) ANDREF(L,2)<REF(L,3);
包顶1:=H<REF(H,1) AND REF(H,1)>REF(H,3)AND L<REF(L,2) ANDREF(L,2)>REF(L,3);
包顶2:=H<REF(H,2) AND REF(H,2)>REF(H,3)AND L<REF(L,1) ANDREF(L,1)>REF(L,3);
复底:=IF(包含1,包底1,IF(包含2,包底2,简底));
复顶:=IF(包含1,包顶1,IF(包含2,包顶2,简顶));
底分型:=IF(BARSLAST(CROSS(牛熊线,重心线))>3,FILTER(BACKSET(FILTER(复底AND 重心线<牛熊线,3),2),1),0);
顶分型:=IF(BARSLAST(CROSS(重心线,牛熊线))>3,FILTER(BACKSET(FILTER(复顶AND 重心线>牛熊线,3),2),1),0);
STICKLINE(底分型,C,O,8,0),COLORFF00FF,LINETHICK2;
STICKLINE(底分型,C,O,3,0),COLORFF00FF,LINETHICK2;
STICKLINE(底分型,H,L,1,0),COLORFF00FF,LINETHICK2;
STICKLINE(顶分型,C,O,8,0),COLORYELLOW,LINETHICK2;
STICKLINE(顶分型,C,O,3,0),COLORYELLOW,LINETHICK2;
STICKLINE(顶分型,H,L,1,0),COLORYELLOW,LINETHICK2;
DRAWTEXT(底分型,L*0.99,'底型'),COLORYELLOW,LINETHICK1;
DRAWTEXT(顶分型,H*1.02,'顶型'),COLORYELLOW,LINETHICK1;
{NCZS 4.0_缠中说禅走势}
{名称:NCZS 4.0}
{描述:缠中说禅走势}
{功能:图解市场一二三类买卖点}
{设计:股市肉鸡}
{版本:4.00}
{日期:2010.02.22}
{参数:SHORT 5/30/7 LONG 10/250/19}
T:=PERIOD;
D:=IF(T=0,30,IF(T=1,25,IF(T=8,25,IF(T=2,20,IF(T=3,20,IF(T=4,20,IF(T=5,10,IF(T=6,10,IF(T=7,10,IF(T=9,10,IF(T=10,10,10)))))))))));
RMA:=EMA(CLOSE,SHORT);
NMA:=EMA(CLOSE,LONG);
UP:DRAWLINE(L=LLV(L,BARSLAST(CROSS(NMA,RMA))+1) AND L=LLV(L,D) ANDRMA<=NMA,L,H=HHV(H,BARSLAST(CROSS(RMA,NMA))+1) ANDH=HHV(H,D) AND RMA>=NMA,H,0),COLORWHITE;
DOWN:DRAWLINE(H=HHV(H,BARSLAST(CROSS(RMA,NMA))+1) AND H=HHV(H,D)AND RMA>=NMA,H,L=LLV(L,BARSLAST(CROSS(NMA,RMA))+1)AND L=LLV(L,D) ANDRMA<=NMA,L,0),COLORWHITE;
{布林+顶底线段}
布林中线:MA(CLOSE,21);
布林上线:布林中线+2*STD(CLOSE,21) COLORGREEN;
布林下线:布林中线-2*STD(CLOSE,21) COLORRED;
局部低点预选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);
局部极点A:=局部低点预选C+局部高点预选C;
AAAA:IF(局部低点预选C=-1,L,IF(局部高点预选C=1,H,DRAWNULL)) CIRCLEDOTCOLORYELLOW;
缺口判断:=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) ANDLLV(L,距前高天+1)<REF(LLV(L,距前高天+1),1),-1,0);
低保留AB:=IF(局部低点预选C=-1 AND REF(距前高天,1)<=REF(距前低天,1)AND (距前高天>=4 OR LLV(缺口判断,距前高天)=-1 ORLLV(L,距前低天+2)<REF(LLV(L,距前低天+1),1)),-1,0);
低保留S:=IF((低保留AA=-1 OR 低保留AB=-1) ANDL<REF(H,距前高天+1),-1,0);
预判:=IF((距前低天<4 AND HHV(缺口判断,距前低天)!=1) ORREF(低保留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) ANDHHV(H,距前低天+1)>REF(HHV(H,距前低天+1),1),1,0);
高保留B:=IF(局部高点预选C=1 AND REF(距前低天,1)<=REF(距前高天,1) ANDREF(低保留S,距前低天)=-1 AND (距前低天>=4 ORHHV(缺口判断,距前低天)=1),1,0);
高保留:=IF((高保留A=1 OR 高保留B=1 OR 判断=1) ANDH>REF(L,距前低天+1),1,0);
预判A:=IF((距前高天<4 AND HHV(缺口判断,距前高天)!=1) ORREF(高保留,距前高天)=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) ANDLLV(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) ANDL<REF(H,距前高天+1),-1,0);
AAAD:=IF(高保留=1 AND 低保留=-1 ANDH>REF(H,REF(距前高天,1)+2),1,IF(高保留=1 AND 低保留=-1 ANDL<REF(L,REF(距前低天,1)+2),-1,0));
极点保留:=IF(AAAD=0,高保留+低保留,AAAD);
局部极点:=IF(极点保留=-1,L,IF(极点保留=1,H,DRAWNULL)) CIRCLEDOTCOLORYELLOW;
DRAWLINE(极点保留=-1,局部极点,极点保留=1,局部极点,0)COLORBLUE;
DRAWLINE(极点保留=1,局部极点,极点保留=-1,局部极点,0)COLORBLUE;
联系客服