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

[amibroker] Re: K-Ratio Implementation (revisited)



PureBytes Links

Trading Reference Links

Thanks Thomas, but no, I don't believe that post does not answer my 
question.  The post below explains the the difference between K-Ratio
(1996) and K-Ratio(2003).  However, it does not explain the 
Backtester results.

K-Ratio(1996) = LinRegSlope / (StdErr * sqrt(n))
K-Ratio(2003) = LinRegSlope / (StdErr * n)
K-Ratio(Ami)  = LinRegSlope / StdErr  * sqrt(n) / sqrt(12)

The sqrt(12) function is typically used to convert a monthly StdDev 
(or StdErr) to an annualized one. I do not understand its purpose 
here.

Alternatively, there could be additional errors in mys undertanding 
of these functions:

LinRegSlope returns the slope for 1 period.  Since the slope is 
linear, it can be annualized by multiplying a daily slope by 252 
market days in a year.  Multiplying by n will provide total increase 
over the entire backtest.

StdErr returns the standard error function (the 1-period average of 
the entire range).  Since it is essentially a 1-period standard 
deviation, to annualize this value you should multiply by sqrt(252).

It seems to me that LRS / StdErr = K-Ratio for one day.

To annualize this, it should be multiplied by 252/ sqrt(252).
Of course, any number multiplied by its sqrt = its sqrt, to the 
annualized version can be simplified to 

LRS/ StdErr * sqrt(252).  

If for some reason, you do not want an annualized version that can be 
compared for various time frames, you can create the cumulative 
version by replacing 252 with n (the number of observations).  This 
suggests that sqrt(252) should be in numerator instead of n being in 
the denominator.

My thinking and/or assumptions must be off somewhere, but I cannot 
determine where.



--- In amibroker@xxxxxxxxxxxxxxx, Thomas Ludwig <Thomas.Ludwig@xxx> 
wrote:
>
> TJ once explained that in a posting in this list:
> 
> > Hello,
> 
> > By the way it is NOT surprising that you are getting lower values
> >than before.
> 
> > In his book Mr. Lars Kestner writes:
> 
> > ' The K-ratio is a unitless measure of performance that can be
> >compared across markets and time periods. [ - - - ] Traders should
> > search for strategies yielding K-ratios greater than +0.50.
> >Together, the Sharpe ratio and K-ratio are the most important
> > measures when evaluating trading strategy performance. Note: When
> >I created the K-ratio in 1996, I thought I had created a
> > robust measure to evaluate performance. In mid-2000, trader Bob
> >Fuchs brought a small error to my attention regarding the
> > scaling of the K-ratio. He was correct in his critique and I have
> >corrected the error in this text. Publications prior to 2002 will
> > show a different formula for the K-ratio. The updated formula in
> >this book is correct.'
> 
> > Previous AB versions contained old K-ratio formulation [of 1996]
> >and newest one contains
> > new formulation [from Kestners book of 2003].
> 
> > The difference between those two formulations [i.e. 'trader Bob
> >Fuchs brought a small error to my attention regarding the
> > scaling of the K-ratio. ' ]
> > is just the factor denominator that is now [NumberOfObservations]
> >instead of SQRT[ NumberOfObservation]
> 
> > Since [NumberOfObservations]/SQRT[NumberOfObservations] = SQRT
> >[NumberOfObservations]
> > it makes it obvious that new K-ratio figures will be SQRT
> >[NumberOfObservations] times smaller than previous.
> 
> > The relationship between new and old version can be written as:
> >
> > KRatio[ NEW2003 ] = KRatio[ OLD1996 ]/SQRT[NumberOfObservations]
> 
> > You can correspond with Mr. Kestner why 'new' is better than 'old'
> >but do not discuss this with me, because I did not invent it.
> 
> I guess that answers your question.
> 
> Greetings, Thomas
> 
> > I made two posts on this subject a couple of weeks ago, but it 
seems
> > those posts have disappeared.
> >
> > Anyway.  I am now able to duplicate the AmiBroker 4.96 beta CBT 
results
> > for K-Ratio.  My implmentation follows and appears to match the
> > AmiBroker results for backtest periods lasting from 2 months to 
17+
> > years.
> >
> > Eq = Foreign("~~~EQUITY", "C");	// Assign Close of Backtest 
Equity = Eq
> > n  = Barcount -1; // Number of periods
> >
> > // K-Ratio - only valid for non-compounding systems
> > EqLRS = LinRegSlope(Eq, n+1); // Linear Reg Slope of entire (n+1) 
range
> > EqSE  = StdErr(Eq, n+1);// Std Err of entire (n+1) range
> > EqKR  = EqLRS/EqSE;    // K-Ratio (unitless measure)
> > EqKRAmi	= EqKR*sqrt(n+1)/sqrt(12);// AmiBroker 4.96 
implementation
> >
> > My question is:  Why does it require a divide by sqrt(12) to work?
> >
> >
> >
> >
> > 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/