MetaStock -> Tools -> Indicator Builder -> New -> Copy and paste complete formula between "---8<---" lines. ============ Year's Hi/Lo ============ ---8<----------------------------- { Yearly High & Low v2.0 ©Copyright 2005 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 } yr:=Input("Year [1800~2200]",1800,2200,2004); yrNr:=Input("Year: [1]Selected, [2]All", 1,2,2); plot:=Input("[1]Year's Hi/Lo, [2]NewYear signals",1,2,1); { Start of year } init:=Cum(1)=2; nuYear:=Year()<>Ref(Year(),-1) OR init; { Highest/Lowest of year } YearHi:=HighestSince(1,nuYear,H); YearLo:=LowestSince(1,nuYear,L); { Restrict High to selected year } xYrHi:=If(Year()=yr,YearHi,0); xYrHi:=If(Year()>=yr,xYrHi,C); xYrHi:=ValueWhen(1,xYrHi>0,xYrHi); { Restrict Low to selected year } xYrLo:=If(Year()=yr,YearLo,0); xYrLo:=If(Year()>=yr,xYrLo,C); xYrLo:=ValueWhen(1,xYrLo>0,xYrLo); { Select: individual year's Hi/Lo or all years } pYrHi:=If(yrNr=1,xYrHi,YearHi); pYrLo:=If(yrNr=1,xYrLo,YearLo); { Plot on price chart } If(plot=1,pYrHi,0); If(plot=1,pYrLo,nuYear) ---8<----------------------------- http://www.metastocktools.com