Forum: help


RE: Quantstrat: Several orders per instrument per day? [ Reply ] By: Joshua Ulrich on 2018-01-25 00:34 | [forum:45588] |
Hi Vyacheslav, This forum is no longer used, as the project has moved to GitHub: https://github.com/braverock/quantstrat/ Also, you could ask your question on R-SIG-Finance (you must subscribe to post): https://stat.ethz.ch/mailman/listinfo/r-sig-finance Best, Josh |
Quantstrat: Several orders per instrument per day? [ Reply ] By: Vyacheslav Zotov on 2018-01-17 04:52 | [forum:45587] |
Hey guys, I'm a bit puzzled with how exactly quantstrat places orders if they are generated within a single day by several subsequent signals/rules. For example, there is a simple zscore-based pair trading strategy with -1/1 entry thresholds and 0 exit threshold. Imagine one day score drops dramatically from below -1 to above 1. Seems like there should be two orders generated for, say, long position going short: sell long, sell short. What is the right way to handle situations like this in QS (if any)? I tried two methods: - Manually add two subsequent orders within order size function with addOrder. This results in one of the orders being moved to 'canceled' state by QS; - Create a set of two rules to trigger an exit order, followed by the entry order. This results in exit order being 'replaced' by QS. I went through the basic pair-trading tutorial distributed together with QS, but seems like the data it uses doesn't include situations of triggering several rules at once. Should I try order-chaining or some other QS features I'm not aware of? Also - what is the easiest way to visualize or print out the steps of internal process QS uses to decide which order to place/cancel/reject/etc? Thanks! |