BASE:0;
{BASE为换手率基准点,在BASE之前的日期其换手率被置0,相当于没交易}
HSL1:= vol*100/FINANCE(7)*100;
HSL:=IF(BASE>=BARSCOUNT(C),0,HSL1);{BASE前的取值取0,相当于BASE后1天为起点}
WCHS1:=SUMBARS(HSL,100);
{完成换手,设置>99000是因为用FINANCE(7)计算换手率间隔WCHS1在上市前几天数据异常,直接置0。}
WCHS:IF(WCHS1>99000 OR WCHS1<0,0,WCHS1),LINETHICK3,COLORC000FF;
BC:=BARSCOUNT(C);{上市到目前的天数}
SH:=SUM(HSL,0);{上市到目前的总换手率}
P:=INTPART(SH/100)*100;{换手满100%的次数}
CDAY:=IF(P>REF(P,1),BC,0);
{把最近一次完全换手后,累计换手达到25%,50%,75%,100%位置标识出来}
C25:=crOSS(SH-REF(SH,BArslAST(CDAY>0)),25),NODRAW;
C50:=CROSS(SH-REF(SH,BARSLAST(CDAY>0)),50),NODRAW;
C75:=CROSS(SH-REF(SH,BARSLAST(CDAY>0)),75),NODRAW;
{换手间隔}
HSJG: IF(CDAY>0 OR C50 OR C25 OR C75,WCHS,0),COLOR22FF33;
DRAWTEXT(C25,WCHS,'25%%');
DRAWTEXT(C50,WCHS,'50%%');
DRAWTEXT(C75,WCHS,'75%%');
DRAWTEXT(CDAY>0,WCHS,'100%%');
DRAWICON(CDAY>0,WCHS,1);