{自动画通道} UR:=10;LR:=10; TC1:=IF(H=HHV(H,1*UR),H,DRAWNULL); TC2:=CONST(BARSLAST(TC1=H))+1; UPPER:=CONST(IF(TC2=1,H,REF(H,TC2-1))); BC1:=IF(L=LLV(L,1*LR),L,DRAWNULL); BC2:=CONST(BARSLAST(BC1=L))+1; LOWER:=CONST(IF(BC2=1,L,REF(L,BC2-1))); LP:=CURRBARSCOUNT<=BC2 AND L=LOWER;{低点定位} HP:=CURRBARSCOUNT<=TC2 AND H=UPPER;{高点定位} NOD:=(IF(TC2>BC2,TC2,BC2)-IF(TC2>BC2,BC2,TC2));{用时} LR1:=FORCAST(C,NOD+1); NP:=IF(CURRBARSCOUNT<=MAX(BC2,TC2),CONST(IF(MIN(TC2,BC2)=1,LR1,REF(LR1,MIN(TC2,BC2)-1))),DRAWNULL);{近点} LR2:=SLOPE(C,NOD+1); LR3:=CONST(IF(MIN(TC2,BC2)=1,LR2,REF(LR2,MIN(TC2,BC2)-1))); FP:=NP-LR3*(NOD);{远点} EQU:=(NP+FP)/2; AD:=ABS(NP-FP);{高差} DBL:=BARSLAST(BC1!=DRAWNULL)+1; DBH:=BARSLAST(TC1!=DRAWNULL)+1; BSP:=IF(BC2>TC2,DBL,DBH)-3; BSPP:=IF(BC2>TC2,DBL,DBH)+3; LRL:=IF(NP>FP,FP+AD/NOD*BSP,FP-AD/NOD*BSP); LRLL:=IF(NP>FP,FP+AD/NOD*BSPP,FP-AD/NOD*BSPP); AT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND H>LRL,H,LRL); AT2:=HHV(AT1-LRL,MAX(BC2,TC2)); AT3:=CONST(BARSLAST(AT1-LRL=AT2)); AT4:=CONST(IF(AT3=0,H,REF(H,AT3))); AT5:=CONST(IF(AT3=0,AT1-LRL,REF(AT1-LRL,AT3))); ATL:=LRL+AT5; UT1:=IF(BETWEEN(CURRBARSCOUNT,BC2,TC2) AND L<LRL,L,LRL); UT2:=HHV(LRL-UT1,MAX(BC2,TC2)); UT3:=CONST(BARSLAST(LRL-UT1=UT2)); UT4:=CONST(IF(UT3=0,H,REF(H,UT3))); UT5:=CONST(IF(UT3=0,LRL-UT1,REF(LRL-UT1,UT3))); UTL:=LRL-UT5; RH:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-1,ATL,CONST(REF(ATL,MIN(BC2,TC2)-1)));{限制高} RL:=IF(CURRBARSCOUNT>=MIN(BC2,TC2)-1,UTL,CONST(REF(UTL,MIN(BC2,TC2)-1)));{限制低} 上:IF(NP>FP,IF(LRLL<=RH,LRLL,DRAWNULL),IF(LRLL>=RL,LRLL,DRAWNULL)),COLOR628962; 中:IF(NP>FP,IF(LRL<=RH,LRL,DRAWNULL),IF(LRL>=RL,LRL,DRAWNULL)),COLOR628962; 下:中-(上-中),COLOR628962; 上上:上+(上-中),COLOR628962,DOTLINE; 下下:下-(中-下),COLOR628962,DOTLINE;