MetaStock -> Tools -> Indicator Builder -> New -> copy & paste complete formula below. ====================== Calendar Week of Month ====================== ---8<------------------------------------- { True Calendar Week-of-Month signals v2.0 Plot is independent of any missing chart data. ©Copyright 2002~2006 Jose Silva. The grant of this license is for personal use only - no resale or repackaging allowed. All code remains the property of Jose Silva. http://www.metastocktools.com } { User inputs } WeekOfMonth:=Input("[1]st [2]nd [3]rd [4]th [5]th week in month",1,5,1); plot:=Input("[1]Week signals, [2]Week count", 1,2,1); adj:=Input("Week's start: [0]Sunday, [1]Monday",0,1,1); { Calendar counter engine } 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)-730484; 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(); adj:=adj+If(DayNr<1,1,2) -(Frac(Year()/100)=0 AND Frac(Year()/400)<>0); WkCount:=Int((DayNr-adj)/7)+(Year()>=2000); { Month's start signal } nuMonth:=Month()<>Ref(Month(),-1) OR Cum(1)=2; { Monthly Week counter, signal } weekNr:=WkCount-ValueWhen(1,nuMonth,WkCount)+1; signal:=weekNr=WeekOfMonth; { Plot in own window } If(plot=1,signal,WeekNr) ---8<------------------------------------- http://www.metastocktools.com