Reputation: 11
I am writing a strategy that only works if I can execute one long and one short order at a time. For example, if a long order is open I should still be able to place a short order (hedge) but I should not place another long order. The only way I have found so far is to make two separate strategies for the short and long so that I can use
if (strategy.opentrade == 0)
*enter trade*
so I do not add another trade in the same direction. However, I would like to be able to all this in one strategy instead of two. How do I prevent my strategy from making trades in the same direction as any open trades?
Upvotes: 1
Views: 1704
Reputation: 3828
The backtest engine doesn't support long and short positions at the same time. Trigger for short order will automatically close the long position and vice versa. Also if the pyramiding is turned off only 1 entry in the same direction will be executed.
Upvotes: 1