Quantcast

Anyone can help with backtesting?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Anyone can help with backtesting?

Sebastian Steins
Hi,

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
idea.

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
weights.

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!


Sebastian

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Anyone can help with backtesting?

julien cuisinier

I do not know this package (so it could be brilliant) but I would go for quantstrat instead, seems more used / followed and hence less bug prone I guess



> Date: Fri, 9 Mar 2012 15:38:02 +0100
> From: [hidden email]
> To: [hidden email]
> Subject: [R-SIG-Finance] Anyone can help with backtesting?
>
> Hi,
>
> 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
> idea.
>
> 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
> weights.
>
> 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!
>
>
> Sebastian
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.
     
        [[alternative HTML version deleted]]

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Anyone can help with backtesting?

Sebastian Steins
Anyway, what would be the way to implement such a strategy in quantstrat?

On Fri, Mar 9, 2012 at 5:13 PM, julien cuisinier
<[hidden email]> wrote:

> I do not know this package (so it could be brilliant) but I would go for
> quantstrat instead, seems more used / followed and hence less bug prone I
> guess
>
>
>
>> Date: Fri, 9 Mar 2012 15:38:02 +0100
>> From: [hidden email]
>> To: [hidden email]
>> Subject: [R-SIG-Finance] Anyone can help with backtesting?
>
>>
>> Hi,
>>
>> 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
>> idea.
>>
>> 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
>> weights.
>>
>> 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!
>>
>>
>> Sebastian
>>
>> _______________________________________________
>> [hidden email] mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>> -- Subscriber-posting only. If you want to post, subscribe first.
>> -- Also note that this is not the r-help list where general R questions
>> should go.

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Anyone can help with backtesting?

Jeffrey Ryan-2
For quantstrat there is _copious_ documentation in the demos and on this list.

You'll also be advised to get familiar with R if you intend on using
R.  Myriad of sources for this as well, including some good books out
there.  No books cover quantstrat at present, though Data Mining with
R by Torgo has a large chapter using quantmod/xts and custom code
which is a decent place to see how things work without the niceties of
quanstrat as a strategy abstraction.

R Cookbook by Teetor is also a nice intro to R.

Jeff

On Fri, Mar 9, 2012 at 10:21 AM, Sebastian Steins
<[hidden email]> wrote:

> Anyway, what would be the way to implement such a strategy in quantstrat?
>
> On Fri, Mar 9, 2012 at 5:13 PM, julien cuisinier
> <[hidden email]> wrote:
>> I do not know this package (so it could be brilliant) but I would go for
>> quantstrat instead, seems more used / followed and hence less bug prone I
>> guess
>>
>>
>>
>>> Date: Fri, 9 Mar 2012 15:38:02 +0100
>>> From: [hidden email]
>>> To: [hidden email]
>>> Subject: [R-SIG-Finance] Anyone can help with backtesting?
>>
>>>
>>> Hi,
>>>
>>> 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
>>> idea.
>>>
>>> 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
>>> weights.
>>>
>>> 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!
>>>
>>>
>>> Sebastian
>>>
>>> _______________________________________________
>>> [hidden email] mailing list
>>> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
>>> -- Subscriber-posting only. If you want to post, subscribe first.
>>> -- Also note that this is not the r-help list where general R questions
>>> should go.
>
> _______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.



--
Jeffrey Ryan
[hidden email]

www.lemnica.com
www.esotericR.com

R/Finance 2012: Applied Finance with R
www.RinFinance.com

See you in Chicago!!!!

_______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.
Loading...