N:=5;
M1:=3;
M2:=3;
ZC:=IF(BARPOS=1,1,DAYS1970-DAYS1970[1]<>WEEkdAY-WEEKDAY[1]);
{上市第一日ZC取1,每周初交易日取1,其他交易日取0 }
M:=BArslAST(ZC)+1; { 最后一周交易日 }
周初标记:=DAYS1970-DAYS1970[1]<>WEEKDAY-WEEKDAY[1];
A:=IF(BARPOS=1,1,周初标记);
WO:=if(m=1,o,ref(o,m-1));
WC:=c;
WH:=if(m=1,h,hhv(h,m));
WL:=if(m=1,l,llv(l,m));
VAR1:=WEEKDAY>REF(WEEKDAY,1);
VAR2:=WEEKDAY<REF(WEEKDAY,1);
ZRSV:=(CLOSE-MIN(LLV(WL,SUMBARS(VAR2,1)),LLV(WL,SUMBARS(VAR2,n))))
/(MAX(HHV(WH,SUMBARS(VAR2,1)),HHV(WH,SUMBARS(VAR2,n)))-
MIN(LLV(WL,SUMBARS(VAR2,1)),LLV(WL,SUMBARS(VAR2,n))))*100;
ZK:SMA(ZRSV,SUMBARS(VAR2,m1)-SUMBARS(VAR2,1),1),COLORWHITE;
ZD:SMA(ZK,SUMBARS(VAR2,m2)-SUMBARS(VAR2,1),1),COLORYELLOW;
ZJ:3*ZK-2*ZD,COLORMAGENTA,LINETHICK1;