Excellent! Thanks Thomas!
----- Original Message ----- From: "Thomas Ludwig" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Wednesday, July 02, 2008 2:51 PM Subject: Re: [amibroker] Computing CAR > Hi, > > TJ presented this code some time ago: > > Symbol = "~~~OSEQUITY"; // change the ticker to your preference > > eq = Foreign( Symbol, "C" ); > > //if( Name() != Symbol ) Title = "You should change symbol to " + > Symbol; > > function TotalDays() > { > yy = Year(); > dy = DayOfYear(); > LastLeapYear = (yy % 4) == 1 && yy != 2001; > YearChg = yy != Ref(yy, -1); > YearChg = IIf(IsNull(YearChg), False, YearChg); > YearLen = IIf(YearChg, IIf(LastLeapYear, 366, 365), 0); > return Cum(YearLen) + dy - dy[0]; > } > > dr = 100 * ( eq/Highest(eq) - 1); > profit = 100 * ( eq/eq[0] - 1 ); > > td = TotalDays(); > Days = td[ BarCount - 1 ] - td[ 0 ]; > > Car = 100 * ( ( eq / eq[ 0 ] ) ^ ( 365 / Days ) - 1 ); > > Plot( dr, "DD%", colorRed ); > Plot( Lowest(dr), "Max DD%", colorBlue ); > Plot( profit, "Profit %", colorGreen ); > Plot( Car, "CAR", colorDarkGreen ); > > Plot( Car/Highest( -dr ), "CAR/MDD", colorOrange ); > > I think the main difference is that he's using calendar days while > you're using trading days. > > Greetings, > > Thomas > >> Is there a formula available for the computation of CAR? >> >> I'm working with this: >> >> >> (Ending Value) /(Beginning Value)^(1/Number of years)-1. >> >> >> On a daily chart, I used number of years = number of bars in trade/ >> 251. >> >> But this doesn't match the AB backtest output. >> >> Thanks >> >> >> ------------------------------------ >> >> Please note that this group is for discussion between users only. >> >> To get support from AmiBroker please send an e-mail directly to >> SUPPORT {at} amibroker.com >> >> For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: >> http://www.amibroker.com/devlog/ >> >> For other support material please check also: >> http://www.amibroker.com/support.html >> Yahoo! Groups Links >> >> >> > > > ------------------------------------ > > Please note that this group is for discussion between users only. > > To get support from AmiBroker please send an e-mail directly to > SUPPORT {at} amibroker.com > > For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG: > http://www.amibroker.com/devlog/ > > For other support material please check also: > http://www.amibroker.com/support.html > Yahoo! Groups Links > > >
