[R-SIG-Finance] Anyone can help with backtesting?

Sebastian Steins sebastian.steins at gmail.com
Fri Mar 9 15:38:02 CET 2012


I am currently trying to think about some investment strategies which
I want to backtest in R. So I found this toolbox as a great tool for
doing so: http://systematicinvestor.wordpress.com/2011/11/25/introduction-to-backtesting-library-in-the-systematic-investor-toolbox/

However, since I am not that familiar with R and the way you create
the strategies in code, I am a bit confused on how to implement my

The idea is the following:

There are two basis modules of the portfolio, which should be weighted
about 40:60. To keep things simple at first, think of those modules as
of two strategies, the first one is the rotational trading strategy
(ranked by low volatility)[A], the second one is basically the same
strategy, but ranked by high performance[B].
After one year there should be done something specifically. At the
first day in any new year:
- if the overall profit of module A and B is greater than 0, positions
should be sold until the initial 4:6 ratio is reached again. The free
capital should then be invested in an fixed income ETF.
- if the overall profit of module A and B is less than 0, nothing
should be done.
- If there is any profit in the fixed income ETF, at the first day in
any year positions in the ETF should be closed, the free capital
should then be invested again in modules A, B according to their 4:6

Can you give me any hints on how to implement such a thing, with the
toolbox mentioned above or in any other way? At the moment I do not
even know how to start.

Thank you for your kind support!


More information about the R-SIG-Finance mailing list