当前月:=FRACPART(ROUND(CURRENTDATE/100)/100)*100;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='1',CLOSE,NUMTOSTR(当前月,0)+'月转折日:6、15、21、*25\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='2',CLOSE,NUMTOSTR(当前月,0)+'月转折日:6、15、21\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='3',CLOSE,NUMTOSTR(当前月,0)+'月转折日:6、15、*20、21\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='4',CLOSE,NUMTOSTR(当前月,0)+'月转折日:6、15、21\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='5',CLOSE,NUMTOSTR(当前月,0)+'月转折日:6、*1 2、15、21\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='6',CLOSE,NUMTOSTR(当前月,0)+'月转折日:6、*1 4、21\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='7',CLOSE,NUMTOSTR(当前月,0)+'月转折日:8、15、*1 9、23\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='8',CLOSE,NUMTOSTR(当前月,0)+'月转折日:*6、8、15、23\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='9',CLOSE,NUMTOSTR(当前月,0)+'月转折日:8、15、*1 8、23\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='10',CLOSE,NUMTOSTR(当前月,0)+'月转折日:8、15、23、*31\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='11',CLOSE,NUMTOSTR(当前月,0)+'月转折日:8、15、23、*28\n \n \n \n '),ALIGN5,colorFFFF;
DRAWTEXT(SYSPARAM(2)=BARPOS AND NUMTOSTR(当前月,0)='12',CLOSE,NUMTOSTR(当前月,0)+'月转折日:8、15、23、*31\n \n \n \n '),ALIGN5,colorFFFF;
IF DATATYPE<6 THEN BEGIN
本周期日期:=DATE;
前日期:=REF(DATE,1);
HHDAY0:=SETVAL(BARPOS>2 AND 本周期日期>前日期,HIGH,-SUMBARS(本周期日期>前日期,2)+1,REF(HHV(HIGH,SUMBARS(本周期日期>前日期,1)),1));
LLDAY0:=SETVAL(BARPOS>2 AND 本周期日期>前日期,LOW,-SUMBARS(本周期日期>前日期,2)+1,REF(LLV(LOW,SUMBARS(本周期日期>前日期,1)),1));
HHDAY:=SETVAL(BARSTATUS=2,HHDAY0,-BARSLAST(本周期日期>前日期),HHV(HIGH,(BARSLAST(本周期日期>前日期))+1));
LLDAY:=SETVAL(BARSTATUS=2,LLDAY0,-BARSLAST(本周期日期>前日期),LLV(LOW,(BARSLAST(本周期日期>前日期))+1));
HHDAY[DATACOUNT]:=HHDAY[DATACOUNT-1];
LLDAY[DATACOUNT]:=LLDAY[DATACOUNT-1];
END;
N:=IF(SYSPARAM(1)=DATACOUNT,最近天,DATACOUNT-SYSPARAM(1)+1);
K线测量范围:N,LINETHICK0;
HH:=HHV(HIGH,N);
LL:=LLV(LOW,N);
VN:=N;
IF VN>DATACOUNT THEN
VN=DATACOUNT+1;
TJ:=CLOSE;
FOR I=DATACOUNT DOWNTO DATACOUNT-VN+1 DO BEGIN
HH[I]:=HH[DATACOUNT];
LL[I]:=LL[DATACOUNT];
TJ[I]:=0;
END;
TMP:=SETLBOUND(33,DATACOUNT-VN+1);
TMP:=SETLBOUND(34,DATACOUNT-VN+1);
KKH:=BARSSINCE(HIGH=HH);
KKL:=BARSSINCE(LOW=LL);
NLPOS:=STRTONUM(NUMTOSTR(REF(BARPOS,KKL),0));
NHPOS:=STRTONUM(NUMTOSTR(REF(BARPOS,KKH),0));
多空:=IF(NLPOS>NHPOS,0,1);
K1:=IF(多空>=1,TROUGHBARS(2,精度1,1),PEAKBARS(1,精度1,1));
F1:=IF(多空>=1,PEAKBARS(1,精度2,1),TROUGHBARS(2,精度2,1));
K2:=BARSLAST(K1=0);
K1LAST:=IF(多空>=1,IF(反向测量>=1,PEAKBARS(1,精度3,1),TROUGHBARS(2,精度3,1)),IF(反向测量>=1,TROUGHBARS(2,精度3,1),PEAKBARS(1,精度3,1)));
K2LAST:=IF(BARPOS=DATACOUNT,SUMBARS(K1LAST=0,近单线),0);
K3LAST:=BACKSET(BARPOS=DATACOUNT,K2LAST);
K4LAST:=IF(K3LAST>0,1,-1);
K5LAST:=CROSS(K4LAST,0);
F2:=BARSLAST(F1=0);
KK:=REF(BARPOS,K2);
FF:=REF(BARPOS,F2);
K4:=DATACOUNT-N+1;
P1:=IF(KK>=K4,1,-1);
P2:=IF(FF>=K4,1,-1);
PK1:=CROSS(P1,0);
PK2:=CROSS(P2,0);
KTONOW1:=BARSLAST(PK1);
KTONOW2:=BARSLAST(PK2);
BBP:=REF(BARPOS,KTONOW1);
HH:=REF(HIGH,KTONOW1);
HH2:=IF(多空>=1,REF(HIGH,KTONOW2),REF(HIGH,KTONOW1));
LL2:=IF(多空>=1,REF(LOW,KTONOW1),REF(LOW,KTONOW2));
LLOW:=REF(LOW,KTONOW1);
H1:=STRTONUM(NUMTOSTR(HH,2));
L1:=STRTONUM(NUMTOSTR(LLOW,2));
H2:=STRTONUM(NUMTOSTR(HH2,2));
L2:=STRTONUM(NUMTOSTR(LL2,2));
HE:=IF((全显=-3 OR 全显=3) AND DATATYPE<6,REF(HHDAY,KTONOW1),IF(测量=1,H1,H2));
LE:=IF((全显=-3 OR 全显=3) AND DATATYPE<6,REF(LLDAY,KTONOW1),IF(测量=1,L1,L2));
LL:=STRTONUM(NUMTOSTR(HE-LE,2));
HELAST:=REF(HIGH,BARSLAST(K5LAST));
LELAST:=REF(LOW,BARSLAST(K5LAST));
LLLAST:=HELAST-LELAST;
LIND1:=LE+LL*1.7856;
LIND2:=LE+LL*2.9775;
LIND3:=HE+LL*2.9775;
LIND4:=LE+LL*4.764;
LIND5:=HE+LL*4.764;
LIND6:=LE+LL*6.5;
LIND7:=LE+LL*7.7415;
LIND8:=HE+LL*7.7415;
LIND9:=LE+LL*10.5;
LINK1:=HE-LL*1.7856;
LINK2:=HE-LL*2.9775;
LINK3:=LE-LL*2.9775;
LINK4:=HE-LL*4.764;
LINK5:=LE-LL*4.764;
LINK6:=HE-LL*6.5;
LINK7:=HE-LL*7.7415;
LINK8:=LE-LL*7.7415;
LINK9:=HE-LL*10.5;
LINE1:=IF(多空>=1,LIND1,LINK1);
LINE2:=IF(多空>=1,LIND2,LINK2);
LINE3:=IF(多空>=1,LIND3,LINK3);
LINE4:=IF(多空>=1,LIND4,LINK4);
LINE5:=IF(多空>=1,LIND5,LINK5);
LINE6:=IF(多空>=1,LIND6,LINK6);
LINE7:=IF(多空>=1,LIND7,LINK7);
LINE8:=IF(多空>=1,LIND8,LINK8);
LINE9:=IF(多空>=1,LIND9,LINK9);
LASTDDX1:=LELAST+LLLAST*1.7856;
LASTDDX2:=LELAST+LLLAST*2.9775;
LASTDDX3:=HELAST+LLLAST*2.9775;
LASTDDX4:=LELAST+LLLAST*4.764;
LASTDDX5:=HELAST+LLLAST*4.764;
LASTDDX6:=LELAST+LLLAST*6.5;
LASTDDX7:=LELAST+LLLAST*7.7415;
LASTDDX8:=HELAST+LLLAST*7.7415;
LASTDDX9:=LELAST+LLLAST*10.5;
LASTKDX1:=HELAST-LLLAST*1.7856;
LASTKDX2:=HELAST-LLLAST*2.9775;
LASTKDX3:=LELAST-LLLAST*2.9775;
LASTKDX4:=HELAST-LLLAST*4.764;
LASTKDX5:=LELAST-LLLAST*4.764;
LASTKDX6:=HELAST-LLLAST*6.5;
LASTKDX7:=HELAST-LLLAST*7.7415;
LASTKDX8:=LELAST-LLLAST*7.7415;
LASTKDX9:=HELAST-LLLAST*10.5;
LASTDX1:=IF(多空>=1,IF(反向测量>=1,LASTKDX1,LASTDDX1),IF(反向测量>=1,LASTDDX1,LASTKDX1));
LASTDX2:=IF(多空>=1,IF(反向测量>=1,LASTKDX2,LASTDDX2),IF(反向测量>=1,LASTDDX2,LASTKDX2));
LASTDX3:=IF(多空>=1,IF(反向测量>=1,LASTKDX3,LASTDDX3),IF(反向测量>=1,LASTDDX3,LASTKDX3));
LASTDX4:=IF(多空>=1,IF(反向测量>=1,LASTKDX4,LASTDDX4),IF(反向测量>=1,LASTDDX4,LASTKDX4));
LASTDX5:=IF(多空>=1,IF(反向测量>=1,LASTKDX5,LASTDDX5),IF(反向测量>=1,LASTDDX5,LASTKDX5));
LASTDX6:=IF(多空>=1,IF(反向测量>=1,LASTKDX6,LASTDDX6),IF(反向测量>=1,LASTDDX6,LASTKDX6));
LASTDX7:=IF(多空>=1,IF(反向测量>=1,LASTKDX7,LASTDDX7),IF(反向测量>=1,LASTDDX7,LASTKDX7));
LASTDX8:=IF(多空>=1,IF(反向测量>=1,LASTKDX8,LASTDDX8),IF(反向测量>=1,LASTDDX8,LASTKDX8));
LASTDX9:=IF(多空>=1,IF(反向测量>=1,LASTKDX9,LASTDDX9),IF(反向测量>=1,LASTDDX9,LASTKDX9));
FILLRGN(BARPOS>=BBP,LINE2,LINE3),color1A1010;
FILLRGN(BARPOS>=BBP AND IF(全显>0,1,IF(精度3=0,1,IF(多空,STRTONUM(NUMTOSTR(LINE5,2))<=(STRTONUM(NUMTOSTR(IF(反向测量>=1,LASTDX1,LASTDX9),2))),STRTONUM(NUMTOSTR(LINE5,2))>=(STRTONUM(NUMTOSTR(IF(反向测量>=1,LASTDX1,LASTDX9),2)))))),LINE5,LINE6),color1A1010;
FILLRGN(BARPOS>=BBP AND IF(全显>0,1,IF(精度3=0,1,IF(多空,STRTONUM(NUMTOSTR(LINE7,2))<=(STRTONUM(NUMTOSTR(IF(反向测量>=1,LASTDX1,LASTDX9),2))),STRTONUM(NUMTOSTR(LINE7,2))>=(STRTONUM(NUMTOSTR |