自动波段划线主图
N1:=4;
LC:=REF(CLOSE,1);
RA1:=REF(C,N1)=HHV(C,N1*2+1); RA2:=REF(C,N1)=LLV(C,N1*2+1);
RB1:=FILTER(RA1,N1); RB2:=FILTER(RA2,N1);
RC1:=BACKSET(RB1,N1+1); RC2:=BACKSET(RB2,N1+1);
RD1:=FILTER(RC1,N1); RD2:=FILTER(RC2,N1);
GD1:=BARSLAST(RD1); DD1:=BARSLAST(RD2);
GDTS:=IF(RD1,CURRBARSCOUNT,0);
DDTS:=IF(RD2,CURRBARSCOUNT,0);
GDT1:=IF(GD1,REF(GDTS,GD1),GDTS);
DDT1:=IF(DD1,REF(DDTS,DD1),DDTS);
GDCS1:=CONST(GDT1); DDCS1:=CONST(DDT1);
GINGBUTS1:=REF(GDT1,GD1+1); DINGBUTS1:=REF(DDT1,DD1+1);
GDCS2:=CONST(GINGBUTS1); DDCS2:=CONST(DINGBUTS1);
GDCS13:=CONST(REF(C,GDCS1-1)); DDCS13:=CONST(REF(C,DDCS1-1));
GDCS23:=CONST(REF(C,GINGBUTS1-1)); DDCS23:=CONST(REF(C,DINGBUTS1-1));
XG1:=BACKSET(ISLASTBAR,GDCS1); XD1:=BACKSET(ISLASTBAR,DDCS1);
XG2:=BACKSET(ISLASTBAR,GDCS2); XD2:=BACKSET(ISLASTBAR,DDCS2);
{第一股票公式网-最好的最好的股票公式网 www.ChnmoNey.Com}
M:=2*N1;
RA11:=REF(C,M)=HHV(C,M*2+1); RA22:=REF(C,M)=LLV(C,M*2+1);
RB11:=FILTER(RA11,M); RB22:=FILTER(RA22,M);
RC11:=BACKSET(RB11,M+1); RC22:=BACKSET(RB22,M+1);
RD11:=FILTER(RC11,M); RD22:=FILTER(RC22,M),NODRAW;
GD11:=BARSLAST(RD11); DD11:=BARSLAST(RD22);
GDTSS:=IF(RD11,CURRBARSCOUNT,0);
DDTSS:=IF(RD22,CURRBARSCOUNT,0);
GDT11:=IF(GD11,REF(GDTSS,GD11),GDTSS);
DDT11:=IF(DD11,REF(DDTSS,DD11),DDTSS);
GDCS11:=CONST(GDT11); DDCS11:=CONST(DDT11);
GINGBUTS11:=REF(GDT11,GD11+1); DINGBUTS11:=REF(DDT11,DD11+1);
GDCS22:=CONST(GINGBUTS11); DDCS22:=CONST(DINGBUTS11);
STICKLINE(XG1,GDCS13*0.9999,GDCS13*1,2,1),COLORWHITE;
STICKLINE(XG2,GDCS23*0.9999,GDCS23*1,2,1),COLORGREEN;
STICKLINE(XD2,DDCS23*0.9999,DDCS23*1,2,1),COLORYELLOW;
STICKLINE(XD1,DDCS13*0.9999,DDCS13*1,2,1),COLORRED;
HIGHN:=8;LOWN:=8;HIGHDISPLAY:=0;LOWDISPLAY:=0;ZGDISPLAY:=0;MADISPLAY:=0;
AA:=REF(C,HIGHN)=HHV(C,2*HIGHN+1);
QY:=BACKSET(AA,HIGHN+1);
CC:=FILTER(QY,HIGHN) AND C=HHV(C,HIGHN+1);
DDD:=BARSLAST(CC);
GDTSG:=IF(CC,CURRBARSCOUNT,0);
DINGBU:=IF(DDD,REF(C,DDD),C);{顶部}
DINGBUTS:=IF(DDD,REF(GDTSG,DDD),GDTSG);
DINGBU1:=REF(DINGBU,DDD+1);
GDCSD:=CONST(DINGBUTS);
DINGBUTSD:=REF(DINGBUTS,DDD+1);
GDCSC:=CONST(DINGBUTSD);
DINGBU2:=REF(DINGBU1,DDD+1);
MM:=IF(CURRBARSCOUNT>GDCSC,0,1);
高压:DRAWLINE(CURRBARSCOUNT=GDCS2,C,CURRBARSCOUNT=GDCS1,C,1) COLORFF00FF,LINETHICK1;
DRAWLINE(CURRBARSCOUNT=GDCSC,C,ISLASTBAR,REF(C,GDCSC-1),1),COLOR0055FF,POINTDOT;
DRAWLINE(CURRBARSCOUNT=GDCSD,C,ISLASTBAR,REF(C,GDCSD-1),1),COLORYELLOW,POINTDOT;
AA1:=REF(C,LOWN)=LLV(C,2*LOWN+1);
QY1:=BACKSET(AA1,LOWN+1);
CC1:=FILTER(QY1,LOWN) AND C=LLV(C,LOWN+1);
DDA:=BARSLAST(CC1);
DDTSD:=IF(CC1,CURRBARSCOUNT,0);
YDB:=IF(DDA,REF(C,DDA),C);
DDTST:=IF(DDA,REF(DDTSD,DDA),DDTSD);
DDCSD:=CONST(DDTST);
ZDB:=REF(YDB,DDA+1);
DDTS2:=REF(DDTST,DDA+1);
DDCSC:=CONST(DDTS2);
低支:DRAWLINE(CURRBARSCOUNT=DDCSC,C,CURRBARSCOUNT=DDCSD,C,1) COLORFF00FF,LINETHICK1;
ZGSTAR:=(高压+低支)/2;
ZGEND:=CONST((高压+低支)/2);
STARDAY:=IF(DDCSC<GDCSC,DDCSC,GDCSC);
中轨:DRAWLINE(CURRBARSCOUNT=STARDAY,ZGSTAR,ISLASTBAR,ZGEND,1),COLORFF00FF,LINETHICK1;
DRAWLINE(CURRBARSCOUNT=DDCSD,C,ISLASTBAR,REF(C,DDCSD-1),1),COLORMAGENTA,POINTDOT,;
DRAWLINE(CURRBARSCOUNT=DDCSC,C,ISLASTBAR,REF(C,DDCSC-1),1),COLORCYAN,POINTDOT;
K:SMA(C,3,1),COLORWHITE;
D:SMA(K,3,1),COLORBLUE;
J:3*K-2*D,COLORYELLOW;