[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [amibroker] Computing CAR



PureBytes Links

Trading Reference Links

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

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/amibroker/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/amibroker/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:amibroker-digest@xxxxxxxxxxxxxxx 
    mailto:amibroker-fullfeatured@xxxxxxxxxxxxxxx

<*> To unsubscribe from this group, send an email to:
    amibroker-unsubscribe@xxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/