USD Value Index, MetaStock formula as used in http://www.metastocktools.com/#USindex MetaStock -> Tools -> Indicator Builder -> New -> Copy & paste complete formula between "---8<---" lines. ================= Value Index - USD ================= ---8<------------------------------------------ { US$ value index v6.2 US$ vs Gold/Oil/Wheat composite RoC. Note: Gold/Oil/Wheat commodities must be in US$. First incomplete year plots RoC from 4th bar. Copyright © 2004-2008 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 } { Reference Gold/Oil/Wheat data } Gold:=Fml("URSC path Gold"); Oil:=Fml("URSC path Oil"); Wheat:=Fml("URSC path Wheat"); { User inputs } yr:=Input("RoC start: [1]Yearly, [2]Since [1800~2200]",1,2200,2002); plot:=Input("[1]Composite Index, [2]Year Signals",1,2,1); { Start/End of year } init:=Cum(IsDefined(Gold+Oil+Wheat))=4; nuYear:=Year()<>Ref(Year(),-1) OR init; first:=nuYear AND Year()=yr OR init; nuYear:=If(yr=1,nuYear,first); YearEnd:=PeakBars(1,-(nuYear OR Cum(IsDefined(nuYear))=1 OR init),1)=0; { RoC % Gold } x:=Gold; chPer:=(ValueWhen(1,YearEnd,x)/x-1)*100; chGold:=If(YearEnd=0,chPer, (ValueWhen(2,YearEnd OR init,x)/x-1)*100); { RoC % Oil } x:=Oil; chPer:=(ValueWhen(1,YearEnd,x)/x-1)*100; chOil:=If(YearEnd=0,chPer, (ValueWhen(2,YearEnd OR init,x)/x-1)*100); { RoC % Wheat } x:=Wheat; chPer:=(ValueWhen(1,YearEnd,x)/x-1)*100; chWheat:=If(YearEnd=0,chPer, (ValueWhen(2,YearEnd OR init,x)/x-1)*100); { Composite Gold/Oil/Wheat RoC % } composite:=(chGold+chOil+chWheat)/3; Yroc:=Round(composite*100)/100; { Restrict RoC output to given year } x:=nuYear*IsDefined(Ref(Yroc,-(yr>=1800))); Yroc:=Yroc*IsDefined( BarsSince(If(LastValue(Cum(x))<1,init,x))); { Plot in own window } If(plot=1,Yroc,nuYear-YearEnd) ---8<------------------------------------------ http://www.metastocktools.com