MetaStock -> Tools -> Indicator Builder -> New -> copy & paste complete formula between "---8<---" lines. ======================== OHLC - previous period's ======================== ---8<------------------------------------- { Previous period's OHLC v1.0 Warning: chart's first data bar is ignored. Adapted from: http://www.metastocktools.com/MACDH/Forex.htm ©Copyright 2004~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://metastocktools.com } { User input } type:=Input("OHLC values: [1]Day, [2]Week, [3]Month, [4]Year",1,4,1); { Day's start } DayStart:=DayOfMonth()<>Ref(DayOfMonth(),-1); { Week's start - reference "Calendar Week counter" indicator for accurate weekly signals} WkStart:=DayOfWeek()Ref(Month(),-1); { Year's start } YrStart:=Year()>Ref(Year(),-1); { Selected Daily/Weekly/Monthly/Yearly } start1:=If(type=1,DayStart, If(type=2,WkStart, If(type=3,MthStart,YrStart))); start:=start1 OR Cum(1)=2; { Previous period's Open } Op:=ValueWhen(2,start,O); Op:=ValueWhen(1,Op<>0,Op); { Previous period's High } Hi:=HighestSince(1,start,H); Hi:=ValueWhen(1,start,ValueWhen(2,1,Hi)); Hi:=ValueWhen(1,Hi<>0,Hi); { Previous period's Low } Lo:=LowestSince(1,start,L); Lo:=ValueWhen(1,start,ValueWhen(2,1,Lo)); Lo:=ValueWhen(1,Lo<>0,Lo); { Previous period's Close } Cl:=ValueWhen(1,start1,ValueWhen(2,1,C)); Cl:=ValueWhen(1,Cl<>0,Cl); { Plot on price chart } Op; { <- Green } Hi; { <- Blue } Lo; { <- Red } Cl; { <- Dk Green } ---8<------------------------------------- http://www.metastocktools.com