PureBytes Links
Trading Reference Links
|
Keith,
Change the granularity of your formula to be on a bar basis, as opposed to an annual basis, and you should come out with a value very close to what AB produces.
e.g.
SetCustomBacktestProc("");
if (Status("action") == actionPortfolio) { first = LastValue(ValueWhen(Status("firstbarinrange"), BarIndex())); last = LastValue(ValueWhen(Status("lastbarinrange"), BarIndex())); bo = GetBacktesterObject();
bo.Backtest();
CAR = 100 * ((bo.Equity/bo.InitialEquity) ^ (252 / (last - first + 1)) - 1);
bo.AddCustomMetric("MyCAR", CAR); }
I believe that the information for K-Ratio is out of date. The formula has been revised. I seem to recall the author suggesting that a value of 0.5 was good. Howard has suggested that 0.15 was good.
Note that the metrics you were comparing dealt with return without regard for how that return was achieved. K-Ratio measures the consistency of the return. So, it is not unusual to have strong CAR/MDD with poor K-Ratio. A couple of big gains would improve the former while hurting the latter.
I seem to recall a posting in this forum offering many of the calculations that you're asking for. Otherwise, you can try looking at the Portfolio.afl of IO since it displays many of the same values.
Mike
--- In amibroker@xxxxxxxxxxxxxxx, Keith McCombs <kmccombs@xxx> wrote: > > Mike -- > The tooltip (which I must admit I was unaware of), unfortunately, > provides no more information than the "AmiBroker User's Guide" (which I > referred to in my previous posting). > > Using your suggestion of Googling the metrics, I Googled CAR, and came > up with the following link: > http://www.investorglossary.com/compound-annual-return.htm#rate_definition > resulting in the definition, "The formula for the compound annual return > is ((Ending Value) /(Beginning Value))^(1/Number of years)-1." > > I just ran a portfolio backtest for a strategy from 10/26/07 to > 10/25/09, a period of 2years. The results were: > Initial capital 100000.00 100000.00 100000.00 > Ending capital 134224.01 134224.01 100000.00 > Net Profit 34224.01 34224.01 0.00 > Net Profit % 34.22 % 34.22 % 0.00 % > Exposure % 2.70 % 2.70 % 0.00 % > Net Risk Adjusted Return % 1268.77 % 1268.77 % N/A > Annual Return % 19.79 % 19.79 % 0.00 % > Risk Adjusted Return % 733.63 % 733.63 % N/A > > > Note that the net profit over the two year period is 34.22% and the > Annual Return is shown as 19.79%. However if one calculates the Annual > Return using net profit and the formula above, > 1.3422401^.5 -1 = 15.855%. > > The AB User's Guide suggests that a good system might have the following > characteristics: > "CAR/MaxDD - Compound Annual % Return divided by Max. system % drawdown. > Good if bigger than 2". > > "Sharpe Ratio of trades - Measure of risk adjusted return of investment. > Above 1.0 is good, more than 2.0 is very good." > > "K-Ratio - Detects inconsistency in returns. Should be 1.0 or more." > > The strategy tested above showed the following: > MDD = -8.02% > CAR/MDD = 2.47 > RRR = 4.32 > Sharpe = 5.27 > K-Ratio =0.0051 (seems rather inconsistent with others) > > I have back tested many profitable, low risk systems over the years, and > do not recall ever seeing a K-Ratio greater than 1.0. > > So, I'd still like to have AFL formulas to produce results equivalent to > those shown in AB back tester analysis. > > And, BTW, does AB calculate MDD from High/Low bars or from equity curve > based on closes. I suspect the latter, but don't really know. > > Thank you. > -- Keith > > > Mike wrote: > > > > > > For a textual description, generate a backtest report and then hover > > your mouse over any metric name. The tooltip will provide a > > description of the metric. For most, a mathematical explanation can be > > found via google. > > > > Mike > > > > --- In amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>, > > "Potato Soup" potatosoupz@ wrote: > > > > > > Yes, I still don't have an explanation for what car is. And all the > > others I listed. > > > > > > -----Original Message----- > > > From: Keith McCombs kmccombs@ > > > Date: Mon, 30 Nov 2009 14:05:23 > > > To: amibroker@xxxxxxxxxxxxxxx <mailto:amibroker%40yahoogroups.com>> > > > Subject: Re: [amibroker] What's a good k ratio, > > > and thoughts on when k ratio clashes with MDD and Sharpe? > > > > > > One thing that I would find most helpful, as far as performance metrics > > > are concerned, is a precise definition of each metric in "AmiBroker > > > User's Guide" (page 156 for v5.20), including AFL formulas to produce > > > results equivalent to those produced by AB back tester analysis. > > > > > > -- Keith > > > > > > Howard B wrote: > > > > > > > > > > > > Hi PS -- > > > > > > > > One way to get a feeling for values for metrics and objective > > > > functions is run an optimization, giving you a range of results. If > > > > necessary, peek into the future so you are certain to get some really > > > > good results. > > > > > > > > Look through the list of results, pick some individual results with a > > > > variety of values for the metrics you want to learn about. > > > > > > > > Set the default value of the optimized variables to the specific > > > > values you chose. > > > > > > > > Run a single backtest. Plot the equity curve. > > > > > > > > When you have done a few of these and have a feeling for the > > > > characteristics of the systems you would like to trade, print out the > > > > plot of the equity curves and write the values of the metrics and > > > > objective functions on the printout. > > > > > > > > ----------------------- > > > > > > > > Your question about interpretation. > > > > > > > > My preference is for objective functions that reward equity growth > > and > > > > penalize drawdown. CAR/MDD, RAR/MDD, RRR, Recovery Factor, K-Ratio, > > > > Ulcer Performance Index, and Sharpe Ratio all do that. In all of > > > > these cases, larger values are better. > > > > > > > > The important results are the out-of-sample results. We are looking > > > > for logic and parameter values that not only perform well in-sample, > > > > but that also perform well out-of-sample. > > > > > > > > When you run walk forward tests, you will find that some objective > > > > functions give high rank to alternatives that do tend to perform well > > > > out-of-sample, while other objective functions select alternatives > > > > that often do not perform well out-of-sample. You will need to run > > > > some of your own tests to get a feeling for how these work on your > > > > trading systems. > > > > > > > > My experience is that using net profit is usually a poor objective > > > > function, although it is the default (and often the only) selection > > > > for some trading systems development platforms other than AmiBroker. > > > > > > > > Fund managers are evaluated on the Sharpe Ratio of their performance. > > > > My experience is that systems selected using Sharpe Ratio tend to > > > > perform poorly out-of-sample. > > > > > > > > Standard Error is a measurement of the smoothness of the equity line > > > > -- smaller values are better. But optimizing to minimize standard > > > > error alone may give high ranks to systems that have trading > > > > characteristics that you do not want. For example, if you have the > > > > options set so that the equity earns interest when ever it is not > > in a > > > > position, then using standard error will reward alternatives that > > stay > > > > in cash and trade infrequently. > > > > > > > > ------------------------ > > > > > > > > One of the very valuable features of AmiBroker is the capability for > > > > the system developer to create whatever objective function he or she > > > > wants to use. It does not have to be limited to those that are > > > > distributed with AmiBroker and appear in the list of metrics. You > > > > might want to combine metrics -- for example to reward alternatives > > > > whose trading frequency suits your preferences, while also rewarding > > > > equity growth and penalizing drawdown. > > > > > > > > Thanks, > > > > Howard > > > > > > > > > > > > > > > > > > > > On Sat, Nov 28, 2009 at 11:33 PM, potatosoupz potatosoupz@ > > > > <mailto:potatosoupz@> wrote: > > > > > > > > > > > > > > > > I don't see any good definitions for the metrics below. I am > > > > familiar of course with Sharpe, and Ulcer Index. I'm finding it a > > > > bit hard to reconcile the differences. How would you reconcile a > > > > backtest that has a max draw down % that is smaller than it's > > > > profit %, a low ulcer index, a high Sharpe, but a very low k ratio > > > > (< .05)? > > > > > > > > Ulcer Index in my mind is one of the best metrics outside of a > > > > much deeper quantitative treatment of things. Thoughts? > > > > > > > > CAR/MDD ? > > > > RAR/MDD ? > > > > Payoff Ratio ? > > > > Standard Error ? > > > > RRR ? > > > > Recovery Factor ? > > > > > > > > > > > > > > > > > > > >
__._,_.___
**** IMPORTANT PLEASE READ ****
This group is for the discussion between users only.
This is *NOT* technical support channel.
TO GET TECHNICAL SUPPORT send an e-mail directly to
SUPPORT {at} amibroker.com
TO SUBMIT SUGGESTIONS please use FEEDBACK CENTER at
http://www.amibroker.com/feedback/
(submissions sent via other channels won't be considered)
For NEW RELEASE ANNOUNCEMENTS and other news always check DEVLOG:
http://www.amibroker.com/devlog/
__,_._,___
|