KG1:=9;F1:=10;
KG:=IF(DATATYPE<=1,1,IF(DATATYPE<=3,5,IF(DATATYPE<=5,10,KG1)));
F:=IF(DATATYPE<=3,1,IF(DATATYPE=4,3,IF(DATATYPE=5,5,F1)));
ZX:=ZIG(4,KG);
CCH:=PEAK(4,KG,1);
CCY:=TROUGH(4,KG,1);
CCHh:=PEAK(4,KG,2);
CCYy:=TROUGH(4,KG,2);
CC:=IF(ZX<REF(ZX,1),CCH,CCY),LINETHICK0;
DD:=IF(ZX<REF(ZX,1),CCY,CCH),LINETHICK0;
CCc:=IF(ZX<REF(ZX,1),CCHh,CCYy),LINETHICK0;
DDd:=IF(ZX<REF(ZX,1),CCYy,CCHh),LINETHICK0;
W1:=CROSS(CCH-0.02,ZX);
W2:=CROSS(ZX,CCY+0.02);
FD:=F/100;
YS:=IF(ZX<REF(ZX,1),FD,-FD);
W:=IF(ZX<REF(ZX,1),W1,W2);
H1:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*0.5,BARSLAST(W)),0),LINETHICK0;
H2:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*0.618,BARSLAST(W)),0),LINETHICK0;
H3:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*1.618,BARSLAST(W)),0),LINETHICK0;
H4:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*1.272,BARSLAST(W)),0),LINETHICK0;
H5:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*1.5,BARSLAST(W)),0),LINETHICK0;
H6:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*1.382,BARSLAST(W)),0),LINETHICK0;
H7:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*2,BARSLAST(W)),0),LINETHICK0;
H8:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*2.5,BARSLAST(W)),0),LINETHICK0;
H9:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*2.618,BARSLAST(W)),0),LINETHICK0;
H10:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*4.236,BARSLAST(W)),0),LINETHICK0;
H11:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*0.382,BARSLAST(W)),0),LINETHICK0;
H12:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*0.764,BARSLAST(W)),0),LINETHICK0;
H13:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*0.809,BARSLAST(W)),0),LINETHICK0;
H14:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*3.236,BARSLAST(W)),0),LINETHICK0;
H15:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*3.618,BARSLAST(W)),0),LINETHICK0;
H16:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*3,BARSLAST(W)),0),LINETHICK0;
H17:if(ZX<REF(ZX,1),REF(cc-(CCc-DD)*1,BARSLAST(W)),0),LINETHICK0;
H18:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*4,BARSLAST(W)),0),LINETHICK0;
H19:if(ZX<REF(ZX,1),REF(CC-(CCc-DD)*0.191,BARSLAST(W)),0),LINETHICK0;
H20:if(ZX<REF(ZX,1),REF(cc-(ccc-dd)*cc/ccc,BARSLAST(W)),0),LINETHICK0;
H1h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*0.5,BARSLAST(W)),0),LINETHICK0;
H2h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*0.618,BARSLAST(W)),0),LINETHICK0;
H3h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*1.618,BARSLAST(W)),0),LINETHICK0;
H4h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*1.272,BARSLAST(W)),0),LINETHICK0;
H5h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*1.5,BARSLAST(W)),0),LINETHICK0;
H6h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*1.382,BARSLAST(W)),0),LINETHICK0;
H7h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*2,BARSLAST(W)),0),LINETHICK0;
H8h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*2.5,BARSLAST(W)),0),LINETHICK0;
H9h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*2.618,BARSLAST(W)),0),LINETHICK0;
H10h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*4.236,BARSLAST(W)),0),LINETHICK0;
H11h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*0.382,BARSLAST(W)),0),LINETHICK0;
H12h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*0.764,BARSLAST(W)),0),LINETHICK0;
H13h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*0.809,BARSLAST(W)),0),LINETHICK0;
H14h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*3.236,BARSLAST(W)),0),LINETHICK0;
H15h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*3.618,BARSLAST(W)),0),LINETHICK0;
H16h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*3,BARSLAST(W)),0),LINETHICK0;
H17h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*1,BARSLAST(W)),0),LINETHICK0;
H18h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*4,BARSLAST(W)),0),LINETHICK0;
H19h:if(ZX>REF(ZX,1),REF(CC+(dd-ccc)*0.191,BARSLAST(W)),0),LINETHICK0;
H20h:if(ZX>REF(ZX,1),REF(cc+(dd-ccc)*cc/ccc,BARSLAST(W)),0),LINETHICK0;
HHD:=SYSPARAM(4);
LLD:=SYSPARAM(5);
系数:=IF(DATATYPE=2,1.00005,IF(DATATYPE<6,1.0005,1.002));
STICKLINE(CC>=LLD AND CC<=HHD,CC,CC*系数,20,0),colorFF;
STICKLINE(CC>=LLD AND CC<=HHD,H1,H1,5,0),colorA0A0A0;
STICKLINE(H1>LLD AND H1<HHD,H2,H2,5,0),colorA0A0A0;
STICKLINE(H2>LLD AND H2<HHD,H3,H3,5,0),colorA0A0A0;
STICKLINE(H3>LLD AND H3<HHD,H4,H4,5,0),colorA0A0A0;
STICKLINE(H4>LLD AND H4<HHD,H5,H5,5,0),colorA0A0A0;
STICKLINE(H5>LLD AND H5<HHD,H6,H6,5,0),colorA0A0A0;
STICKLINE(H6>LLD AND H6<HHD,H7,H7,5,0),colorA0A0A0;
STICKLINE(H7>LLD AND H7<HHD,H8,H8,5,0),colorA0A0A0;
STICKLINE(H8>LLD AND H8<HHD,H9,H9,5,0),colorA0A0A0;
STICKLINE(H9>LLD AND H9<HHD,H10,H10,5,0),colorA0A0A0;
STICKLINE(H10>LLD AND H10<HHD,H11,H11,5,0),colorA0A0A0;
STICKLINE(H11>LLD AND H11<HHD,H12,H12,5,0),colorA0A0A0;
STICKLINE(H12>LLD AND H12<HHD,H13,H13,5,0),colorA0A0A0;
STICKLINE(H13>LLD AND H13<HHD,H14,H14,5,0),colorA0A0A0;
STICKLINE(H14>LLD AND H14<HHD,H15,H15,5,0),colorA0A0A0;
STICKLINE(H15>LLD AND H15<HHD,H16,H16,5,0),colorA0A0A0;
STICKLINE(H16>LLD AND H16<HHD,H17,H17,5,0),colorA0A0A0;
STICKLINE(H17>LLD AND H17<HHD,H18,H18,5,0),colorA0A0A0;
STICKLINE(H18>LLD AND H18<HHD,H19,H19,5,0),colorA0A0A0;
STICKLINE(H19>LLD AND H19<HHD,H20,H20,5,0),colorblue;
STICKLINE(CC>=LLD AND CC<=HHD,H1h,H1h,5,0),colorA0A0A0;
STICKLINE(H1h>LLD AND H1h<HHD,H2h,H2h,5,0),colorA0A0A0;
STICKLINE(H2h>LLD AND H2h<HHD,H3h,H3h,5,0),colorA0A0A0;
STICKLINE(H3h>LLD AND H3h<HHD,H4h,H4h,5,0),colorA0A0A0;
STICKLINE(H4h>LLD AND H4h<HHD,H5h,H5h,5,0),colorA0A0A0;
STICKLINE(H5h>LLD AND H5h<HHD,H6h,H6h,5,0),colorA0A0A0;
STICKLINE(H6h>LLD AND H6h<HHD,H7h,H7h,5,0),colorA0A0A0;
STICKLINE(H7h>LLD AND H7h<HHD,H8h,H8h,5,0),colorA0A0A0;
STICKLINE(H8h>LLD AND H8h<HHD,H9h,H9h,5,0),colorA0A0A0;
STICKLINE(H9h>LLD AND H9h<HHD,H10h,H10h,5,0),colorA0A0A0;
STICKLINE(H10h>LLD AND H10h<HHD,H11h,H11h,5,0),colorA0A0A0;
STICKLINE(H11h>LLD AND H11h<HHD,H12h,H12h,5,0),colorA0A0A0;
STICKLINE(H12h>LLD AND H12h<HHD,H13h,H13h,5,0),colorA0A0A0;
STICKLINE(H13h>LLD AND H13h<HHD,H14h,H14h,5,0),colorA0A0A0;
STICKLINE(H14h>LLD AND H14h<HHD,H15h,H15h,5,0),colorA0A0A0;
STICKLINE(H15h>LLD AND H15h<HHD,H16h,H16h,5,0),colorA0A0A0;
STICKLINE(H16h>LLD AND H16h<HHD,H17h,H17h,5,0),colorA0A0A0;
STICKLINE(H17h>LLD AND H17h<HHD,H18h,H18h,5,0),colorA0A0A0;
STICKLINE(H18h>LLD AND H18h<HHD,H19h,H19h,5,0),colorA0A0A0;
STICKLINE(H19h>LLD AND H19h<HHD,H20h,H20h,5,0),colorblue;
DRAWTEXT(W AND CC>=LLD AND CC<=HHD,H1,''+NUMTOSTR(F*0.5/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H1>LLD AND H1<HHD,H2,''+NUMTOSTR(F*0.618/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H2>LLD AND H2<HHD,H3,''+NUMTOSTR(F*1.618/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H3>LLD AND H3<HHD,H4,''+NUMTOSTR(F*1.272/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H4>LLD AND H4<HHD,H5,''+NUMTOSTR(F*1.5/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H5>LLD AND H5<HHD,H6,''+NUMTOSTR(F*1.382/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H6>LLD AND H6<HHD,H7,''+NUMTOSTR(F*2/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H7>LLD AND H7<HHD,H8,''+NUMTOSTR(F*2.5/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H8>LLD AND H8<HHD,H9,''+NUMTOSTR(F*2.618/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H9>LLD AND H9<HHD,H10,''+NUMTOSTR(F*4.236/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H10>LLD AND H10<HHD,H11,''+NUMTOSTR(F*0.382/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H11>LLD AND H11<HHD,H12,''+NUMTOSTR(F*0.764/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H12>LLD AND H12<HHD,H13,''+NUMTOSTR(F*0.809/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H13>LLD AND H13<HHD,H14,''+NUMTOSTR(F*3.236/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H14>LLD AND H14<HHD,H15,''+NUMTOSTR(F*3.618/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H15>LLD AND H15<HHD,H16,''+NUMTOSTR(F*3/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H16>LLD AND H16<HHD,H17,''+NUMTOSTR(F*1/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H17>LLD AND H17<HHD,H18,''+NUMTOSTR(F*4/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H18>LLD AND H18<HHD,H19,''+NUMTOSTR(F*0.191/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND CC>=LLD AND CC<=HHD,H1h,''+NUMTOSTR(F*0.5/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H1h>LLD AND H1h<HHD,H2h,''+NUMTOSTR(F*0.618/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H2h>LLD AND H2h<HHD,H3h,''+NUMTOSTR(F*1.618/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H3h>LLD AND H3h<HHD,H4h,''+NUMTOSTR(F*1.272/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H4h>LLD AND H4h<HHD,H5h,''+NUMTOSTR(F*1.5/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H5h>LLD AND H5h<HHD,H6h,''+NUMTOSTR(F*1.382/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H6h>LLD AND H6h<HHD,H7h,''+NUMTOSTR(F*2/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H7h>LLD AND H7h<HHD,H8h,''+NUMTOSTR(F*2.5/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H8h>LLD AND H8h<HHD,H9h,''+NUMTOSTR(F*2.618/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H9h>LLD AND H9h<HHD,H10h,''+NUMTOSTR(F*4.236/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H10h>LLD AND H10h<HHD,H11h,''+NUMTOSTR(F*0.382/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H11h>LLD AND H11h<HHD,H12h,''+NUMTOSTR(F*0.764/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H12h>LLD AND H12h<HHD,H13h,''+NUMTOSTR(F*0.809/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H13h>LLD AND H13h<HHD,H14h,''+NUMTOSTR(F*3.236/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H14h>LLD AND H14h<HHD,H15h,''+NUMTOSTR(F*3.618/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H15h>LLD AND H15h<HHD,H16h,''+NUMTOSTR(F*3/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H16h>LLD AND H16h<HHD,H17h,''+NUMTOSTR(F*1/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H17h>LLD AND H17h<HHD,H18h,''+NUMTOSTR(F*4/10,3)+'%'),PXDN5,colorA0A0A0;
DRAWTEXT(W AND H18h>LLD AND H18h<HHD,H19h,''+NUMTOSTR(F*0.191/10,3)+'%'),PXDN5,colorA0A0A0;
AK1:=BARSLAST(W1)+1;
BK1:=BARSLAST(W2)+1;
目前:=IF(BK1>AK1,AK1,BK1);
DRAWNUMBER(W1,CC,REF(目前,1)+1,0),ALIGN2,PXUP30,colorFF00FF;
DRAWNUMBER(W2,CC,REF(目前,1)+1,0),ALIGN2,PXDN10,coloryellow;
方向:=IF(CC=CCH,'下行 ','上升 ');
周期:=IF(DATATYPE=6,'天 ',IF(DATATYPE=7,'周 ',IF(DATATYPE=8,'月 ','单位')));
DRAWTEXTEX(CLOSE>0,0,2,5,'目前波段'+方向+NUMTOSTR(目前+1,0)+周期),colorRED;
DRAWTEXT(W1,CC,''+周期),PXUP30,colorFF00FF;
DRAWTEXT(W2,CC,''+周期),PXDN10,coloryellow;
a:=FLATZIG(4,KG);
z:zig(4,KG),PRECISION2,LINEDOT,COLORWHITE;
aa:=a=0 or a=1 or 是否最后周期;
wq:=barslast(aa);
F:(z/ref(z,ref(wq,1)+1)-1)*100,LINETHICK;
w2:=sumbars(aa,2)-1;
fb:=f/ref(f,ref(w2,1)+1);
显示数字(aa,z,fb,2);