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

[amibroker] Re: K-Ratio Implementation



PureBytes Links

Trading Reference Links

I found minor error in my original post (as I had been testing 
multiple versions).  Last two lines of code need to be changed to
to remove the "2"s.

EqKR = EqLRS / EqSE;	// LRS (Ann) / StdErr (Ann)
bo.AddCustomMetric("K-Ratio", EqKR[n],"","",6);

The results are still the same and do not match AmiBroker output.

--- In amibroker@xxxxxxxxxxxxxxx, "Ron Rowland" <rowland@xxx> wrote:
>
> I am working on a submission to the UKB involving Custom Metrics 
with 
> the CBT.  I have successfully implemented the AFL for a wide range 
of 
> system evaluation metrics such as Loss Deviation, Downside 
Deviation, 
> Sortino Ratio, Treynor Ratio, Information Ratio, and more.
> 
> I have also developed a modified version of the K-Ratio that I call 
> the Klog-Ratio, which is a more useful version of the K-Ratio for 
> systems that compound their returns.
> 
> However, I am having one problem.  I cannot reproduce the AmiBroker 
K-
> Ratio test results.  I come close, but not close enough.  Here is 
my 
> example.  Hopefully, someone can point out my error.
> 
> Backtest run on Current Symbol = SP-CP (S&P Price Index)
> From 12/31/1990 to 12/31/2006 (16 calendar years)
> Starting capital = 1000.
> System = Buy & Hold.
> ----
> 
> Amibroker BackTest Results
>   Annual Return = 9.53%
>   Standard Error = 595.52
>   K-Ratio = 0.0239
> 
> 
> My Custom Metrics code and results
> 
> SetCustomBacktestProc("");
> if(Status("action") == actionPortfolio)
> {
> bo = GetBacktesterObject();
> bo.Backtest();
> 
> Eq = Foreign("~~~EQUITY", "C");	   // Get Equity Line
> n  = BarCount-1;                   // Number of periods	
> // This produces a Bacrount of 4035 and n = 4034
> // I assume 252 market days per year when annualizing daily values
> 
> // Standard Error
> EqSEd = StdErr(Eq,n);	           // Std Err (daily)
> bo.AddCustomMetric("Std Err (daily)", EqSEd[n]); // Output
> // This produces a result of 595.52 (matches AmiBroker output)
> 
> // To annualize a StdDev or Std Err take daily * sqrt(252)
> EqSE = EqSEd * sqrt(252);         // Annualize it
> bo.AddCustomMetric("Std Err Ann", EqSE[n]);	// Output
> // This produces a result of 9454.69
> 
> // Linear Regression Slope
> EqLRSd = LinRegSlope(Eq,n);       // Get Linear Reg Slope
> bo.AddCustomMetric("Equity LRS (daily)", EqLRSd[n]);
> // This produces a result of 0.78
> 
> // To annualize a "linear" slope simply multiply by number of 
periods
> EqLRS = EqLRSd*252;		// Annualize it
> bo.AddCustomMetric("LRSd*252", EqLRS[n]); 
> // This produces a result of 195.90
> 
> // K-Ratio
> EqKR = EqLRS2 / EqSE;	// LRS (Ann) / StdErr (Ann)
> bo.AddCustomMetric("K-Ratio2", EqKR2[n],"","",6);
> // This produces a result of 0.020720
> // AmiBroker test results =  0.0239
> //          Close, but no cigar!
> }
>




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/