back-testing

Quantstrat: Ordersize function

放肆的年华 提交于 2020-03-25 13:40:29
问题 I'm new to R and I'm trying to figure out how to get quantstrat to work with a custom ordersize function. The idea is to always invest all available equity in Bitcoin so that it will be comparable to a B&H strategy. I have provided reproducible code. At first it seems to be working fine but the problem arises when I look at my orderbook. Maybe their is some mismatch between Closing prices but quantstrat doesn't order the amount of Bitcoin in accordance with the available equity. E.g. (from=

Limit number of Position in Quantstrat

蓝咒 提交于 2019-12-08 00:51:39
问题 I have been scratching my head for the last few days trying to understand how to limit the number of position in a strategy. Its a channel breakout strategy (go long/shirt the 20d breakout channel with a 10d high/low stop loss. I don't want the system to pyramid. Only 1 position is accepted i.e - if on day 1 I have a signal, and the market keeps trending, it will print new signals but they have to be dismissed as we are already in a position. I tried everything i've found but i have been