University of South Carolina

Backtesting Playground!

In financial analysis, backtesting is one of the best way to compare trading or investment strategies using historical time series data. The backtesting playground opens a window to those who want to use backtesting approaches to their work and study using R, which is a free and powerful software environment for statistical computing and graphics.

The tutorial document introduces a way to conduct backtesting using the classical Global Minimum Variance Portfolio (GMVP) as an example. By reading this, you can have a brief idea of the components needed to conduct a successful backtesting.

If you have already read the tutorial, this is the shortcut to load the R working space: load(url("http://people.stat.sc.edu/sshen/events/backtesting/backtesting_pack.RData"))

I will keep updating strategy functions as well as corresponding explanation documents in this webpage. At the same time, you are very welcome to write your own strategy functions. I'm very happy to help to integrate your strategies into the backtest function in the working space to benefit more people.

Document List

1. Backtesting Tutorial
2. Test Data
3. xlsx-R-xlsx code
4. Function Details

Useful R Tutorials

1. An Introduction to R
2. R for Beginners
3. R: A self-learn tutorial
4. R Functions for Regression Analysis
5. Practical Regression and Anova using R

Reference Papers

1. A Portfolio Performance Index by Michael Stutzer
2. Maximizing the Sharpe Ratio with Quadratic Programming