Seems like you are defeating the purpose of the metric. Assume you're given 2 x $1,000 on Jan 1, 2006 to invest for 3 years; $1,000 for each of 2 systems.
- System A generates its first trade immediately on Jan 1, 2006 and finishes the 3 year period up $500. - System B does not generate its first trade until Jan 1, 2007 and also finishes the 3 year period up $500. The intent of CAGR is to compare different systems over the same period of time. With respect to CAGR, the two systems are identical. Your proposal would artificially inflate the value of System B concluding that it was superior to A, which is not at all the case. http://www.investorglossary.com/compound-annual-return.htm Mike --- In amibroker@yahoogroups.com, "engineering_returns" <trade2live4e...@...> wrote: > > Hello AmiBroker - Experts, > often i do test strategies within a specific date range. The strategy > backtest report (Annual Return %) doesn't consider the date of the first > trade for calculation. It's using the date of the first bar for > calculation, hence the "Annual Return%" is wrong. Do you have the same > problem? > I've written the following CBT code to account for this problem. Any > feedback / comment is very much appreciated > bo2 = GetBacktesterObject(); trade = bo2.GetFirstTrade(); > Entryd= trade.entrydatetime; bo2.AddCustomMetric( "FirstTrade", > NumToStr( Entryd, formatDateTime ) ); Text = StrRight(NumToStr( > Entryd, formatDateTime ),4); Years = Year()- StrToNum(text) + 1; > bo2.AddCustomMetric( "Years", NumToStr(Years,0) ); Ratio = > stats.getvalue("EndingCapital") / stats.getvalue("InitialCapital"); > CAGR = (Ratio ^ (1/Years)-1)*100; bo2.AddCustomMetric( "CAGR", > NumToStr(Cagr,1.2) ); > > Frank > engineering-returns.com <http://engineering-returns.com/> >