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

[amibroker] Re: Sharpe Ratio



PureBytes Links

Trading Reference Links


Re (from Joe): "BTW - If you're using the AB AutoAnalyser routine. 
wouldn't  the backtesting report give you the Sharpe Ratio. "

Yes -- but that's why I asked about programmatic access. It may be 
beyond my meager skills but I've been thinking of doing individual 
backtests over a set of stocks and then, as second step, do a 
portfolio level backtest using the Sharpe ratios from the first step 
as the position scoring method.

The problem is that results from the first test need to be saved 
somewhere to be accessible to the second step. But I think this might 
be possible using some combination of static or dynamic variables 
(or -- worst case -- in a file).

Has anybody done anything similar to this and, if so, any suggestions 
would be appreciated.

Dan



--- In amibroker@xxxxxxxxxxxxxxx, "Joe Landry" <jelandry@xxxx> wrote:
> Here's some raw material that may be useful.  Note that you need an 
array of a standard rate of return. That's calculated by the function 
below - Irate(5) for 5 %, the
> percentage is something you choose. 
> 
> Then in the last line used to calculate the Sharpe ratio, place 
your equity in there... in your case I'm thinking you are measuring 
the <~~~equity> from your backtesting. 
> 
> BTW - If you're using the AB AutoAnalyser routine. wouldn't  the 
backtesting report give you the Sharpe Ratio. 
> 
> Credit for these forumlas due to Bruce, and others.  Hope this 
helps.
> 
> JOE 
> 
> function Irate(interest_rate)
> {
> // This gets the log of the daily rate
> logbarfactor = log(1 + interest_rate / 100) / 252;
> 
> // Force the first bar to 0
> logvect = IIf(BarIndex() == 0, 0, logbarfactor);
> 
> // Sum the log of the daily gain factors and
> // convert back to get equity
> return(exp(Cum(logvect)));
> }
> 
> //   Plot this in your testing to see if  you agree
> // Test with an APR of 5.%
>   vect = Irate(5);
> ////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////
> 
> // SHARPE PERFORMANCE INDEX a risk adjusted measure of the 
performance of an equity compared to the risk free benchmark standard 
rate of return eg = 5%
>      vect = Irate(5);   // use this intermediate step or place in 
the forumla below  
>     SHARPE = ( MA(ROC(C,1),252) - MA(ROC(Vect,1),252) )/(SDF);
> 
> 
> 
>   ----- Original Message ----- 
>   From: Nigel Rowe 
>   To: amibroker@xxxxxxxxxxxxxxx 
>   Sent: Tuesday, December 07, 2004 1:01 AM
>   Subject: Re: [amibroker] Re: Sharpe Ratio
> 
> 
>   -----BEGIN PGP SIGNED MESSAGE-----
>   Hash: SHA1
> 
>   <re-sequenced for bottom posting>
> 
>   > --- In amibroker@xxxxxxxxxxxxxxx, "danielwardadams"
>   > <danielwardadams@xxxx> wrote:
>   > > Is there any way to programmatically access the Sharpe Ratio
>   > > resulting from a backtest?
>   > >
>   > > TIA,
>   > > Dan
> 
>   On Tue, 7 Dec 2004 17:44, Pal Anand wrote:
>   > Dan,
>   >
>   > This may help:
>   >
>   > http://finance.groups.yahoo.com/group/amibroker-ts/message/2369
>   >
>   > rgds, Pal
> 
>   The word 'sharpe' doesn't appear anywhere on that page.  If 
that's the page 
>   you meant to reference, how does it help?
> 
>   - -- 
>         Nigel Rowe
>         rho@xxxx
> 
> 
>   -----BEGIN PGP SIGNATURE-----
>   Version: GnuPG v1.2.4 (GNU/Linux)
> 
>   iD8DBQFBtVU6BbmcM2pfckkRAvRlAKCIdU95mcj5VfAd/9Cbv7nhYuOvJACg8kwe
>   hwRXucGcS3RFp3/9ISFJ41M=
>   =hAyH
>   -----END PGP SIGNATURE-----
> 
> 
>   Check AmiBroker web page at:
>   http://www.amibroker.com/
> 
>   Check group FAQ at: 
http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
> 
> 
>         Yahoo! Groups Sponsor 
>               ADVERTISEMENT
>              
>        
>        
> 
> 
> --------------------------------------------------------------------
----------
>   Yahoo! Groups Links
> 
>     a.. To visit your group on the web, go to:
>     http://groups.yahoo.com/group/amibroker/
>       
>     b.. To unsubscribe from this group, send an email to:
>     amibroker-unsubscribe@xxxxxxxxxxxxxxx
>       
>     c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.





------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/GHeqlB/TM
--------------------------------------------------------------------~-> 

Check AmiBroker web page at:
http://www.amibroker.com/

Check group FAQ at: http://groups.yahoo.com/group/amibroker/files/groupfaq.html 
Yahoo! Groups Links

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

<*> 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/