1

This is my first question on stackoverflow so pleace have mercy with me.

I am using the R quantmod and quantstrat packages for backtesting trading strategies.
Unfortunately I cannot figure out how to implement a maximum period for a position. I what the position, short or long, to not last longer than say 5 days.

Thanks

Edurne Pascual
  • 5,560
  • 1
  • 26
  • 31
  • 3
    Hi and welcome to stackoverflow! Please read some of the guidelines for SO: [**here**](http://stackoverflow.com/help/on-topic), [**here**](http://meta.stackoverflow.com/help/how-to-ask), [**here**](http://meta.stackexchange.com/questions/156810/stack-overflow-question-checklist). People are much more happy to help if you post a [**minimal, reproducible example**](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610#5963610), the code you have tried and why it didn't work, and the expected results. Thanks. – Henrik Jan 27 '14 at 10:45
  • How do you download the data for testing ? – Tomasz Waszczyk Jan 27 '14 at 14:34
  • Hi Thanks for the comments. I do not have code that does not work, since I wanted to ask if there is a build in way (like addPosLimt) or someone had already written such an example. I am very new to quantstrat but I will try some things now. @Mr Phi I have the data as a xts on a server. Is that important? – user3239929 Jan 27 '14 at 14:44
  • The thing is.. I look for the data in order to test ;-) – Tomasz Waszczyk Jan 27 '14 at 14:48

1 Answers1

0

quantstrat is a signal-based backtesting system.

Rules for how you hold a position, such as position sizing, or duration, are managed by your trading workflow.

So, no, quantstrat is not the tool you are looking for. quantstrat is the tool you use to test rules for entering and exiting positions (signals).