I have a long/short strategy and on a signal the strategy creates a trade set. A trade set contains up to 7 to 8 trades long or short (mutually exclusive). The orders are a mix of market and limit orders.
The problem I have is that my "limit orders" do not get canceled when there's a counter trade signal.
For example,
(1) On LONG signal submit 1x EnterLong(name, quantity) and 6 x EnterLongLimit(0, true, quantity, limit_price, name).
(2) Market orders get filled, some limit orders do to. So far, so good.
(3) On SHORT signal submit 1x EnterShort(name, quantity) and 7 x EnterShortLimit(0, true, quantity, limit_price, name).
(4) Long positions close. 1 or more short signals get filled.
(5) Long orders that didn't get filled in (1) get filled after (3).
Here's an example of a test strategy to illustrate this problem:
(6) Long orders with the prefix "Long_EP_60_x" were submitted with the trade set in step (1). I've tried canceling them but they don't show up in Orders.
(7) I've looked into Foreach (Order o in Orders) {....} to see if I can trace but Orders.count ==0
I'm stumped.
If the strategy is LONG then SHORT, does NT automatically close all long positions and outstanding orders? It appears that way when I check Orders.count; however, on the chart and in the strategy report it appears that pending orders do not get canceled on a counter trade signal.
Thank you
Comment