MetaStock -> Tools -> Indicator Builder -> New Copy and paste formulae below. ======================== Calendar Weekday counter ======================== ---8<--------------------------- { Weekday (Mon~Fri) counter from 1960 } { Count is independent of any missing chart data } { ©Copyright 2003 Jose Silva } { http://www.metastocktools.com } limit:=1960; {do not change limit year} LimLeap:=Frac(limit/4)=0 AND Frac(limit/100)<>0 OR Frac(limit/400)=0; NoCount:=limit*365+Int(limit/4) -Int(limit/100)+Int(limit/400)-LimLeap; leap:=Frac(Year()/4)=0 AND Frac(Year()/100)<>0 OR Frac(Year()/400)=0; y:=Year()*365+Int(Year()/4) -Int(Year()/100)+Int(Year()/400)-NoCount; m:= If(Month()=2,31-leap, If(Month()=3,59, If(Month()=4,90, If(Month()=5,120, If(Month()=6,151, If(Month()=7,181, If(Month()=8,212, If(Month()=9,243, If(Month()=10,273, If(Month()=11,304, If(Month()=12,334, -leap))))))))))); DayNr:=y+m+DayOfMonth(); WkDayCount:= Int((DayNr+3)/7)+ {Mon} Int((DayNr+2)/7)+ {Tue} Int((DayNr+1)/7)+ {Wed} Int((DayNr)/7)+ {Thu} Int((DayNr-1)/7); {Fri} WkDayCount ---8<--------------------------- ==================== Missing trading days ==================== ---8<--------------------------- {Plots missing daily (weekday) bars count} {©Copyright 2003-2004 Jose Silva} {http://www.metastocktools.com} ChkVol:=Input("Zero-volume days = missing data days? Yes=1, No=0",0,1,1); VolMissing:=If(ChkVol,V=0,0); limit:=1960; {do not change limit year} LimLeap:=Frac(limit/4)=0 AND Frac(limit/100)<>0 OR Frac(limit/400)=0; NoCount:=limit*365+Int(limit/4) -Int(limit/100)+Int(limit/400)-LimLeap; leap:=Frac(Year()/4)=0 AND Frac(Year()/100)<>0 OR Frac(Year()/400)=0; y:=Year()*365+Int(Year()/4) -Int(Year()/100)+Int(Year()/400)-NoCount; m:= If(Month()=2,31-leap, If(Month()=3,59, If(Month()=4,90, If(Month()=5,120, If(Month()=6,151, If(Month()=7,181, If(Month()=8,212, If(Month()=9,243, If(Month()=10,273, If(Month()=11,304, If(Month()=12,334, -leap))))))))))); DayNr:=y+m+DayOfMonth(); WkDayCount:= Int((DayNr+3)/7)+ {Mon} Int((DayNr+2)/7)+ {Tue} Int((DayNr+1)/7)+ {Wed} Int((DayNr)/7)+ {Thu} Int((DayNr-1)/7); {Fri} WkDayCount-ValueWhen(2,1,WkDayCount)-1 +VolMissing ---8<--------------------------- http://www.metastocktools.com