- ago
Experiencing if one of multiple simultaneous triggered orders (Quotes Window) for the same symbol gets filled, all remaining orders get cancelled. The red info box in TWS says "Cancelled by Trader".

Any idea?

0
410
Solved
9 Replies

Reply

Bookmark

Sort
Cone8
 ( 5.57% )
- ago
#1
Not enough information.
Are we talking about the same symbol? Triggers for different symbols?

I'm trying just to grasp the idea of multiple simultaneous triggers. Unless it happens right at the open, I can hardly even imagine "simultaneous" triggers.
0
- ago
#2
All triggers for the same symbol. For long, if the open is lower than the trigger threshold (off all orders), multiple orders get triggered simultaneously right at the open. Or, if two triggers are identical.
0
Cone8
 ( 5.57% )
- ago
#3
I asked Glitch to take a look, but I think we're going to have to call that scenario "Auto-Trade-incompatible" for now.
We'd have to make some changes to handle it.

You might have better luck with the Trading Preference > Misc Trading Settings > Convert Limit/Stop to Market if current quote exceeds price.
0
- ago
#4
Okay, thanks for the explanation.

May I ask what exactly is the reason why the orders that have already been transmitted are then canceled?
0
Cone8
 ( 5.57% )
- ago
#5
Because the Transactions have the same CancelationCode (probably null or 0), which causes the orders to be Canceled and Replaced, successively.

I just chatted with Glitch, who led me down that path, and I already tested that if you assign a different CancelationCode to each of the Transactions it will work.

Example:
CODE:
               Transaction t = PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, bars.Close[idx] * 1.005);                t.CancelationCode = 13;                t = PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, bars.Close[idx] * 1.01);                t.CancelationCode = 14;                t = PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, bars.Close[idx] * 1.015);                t.CancelationCode = 15;
0
Best Answer
- ago
#6
This makes sense! So this is also working for orders which are generated from different strategies (MetaStrategy) with different Cancelation Codes for each strategy?
0
Glitch8
 ( 10.10% )
- ago
#7
Yes, MetaStrategy components are considered separate groups.
0
- ago
#8
Perfect, will test this option the next week, thanks! :-)
0
- ago
#9
Edit: I tried assigning different Cancelation Codes (ranges) to each Child Strategy like this:

Strategy 1 --> 1-5
Strategy 2 --> 6-10
Strategy 3 --> 11-15
...

Unfortunately, the orders (for the same symbol) still cancel out each other.

CODE:
   {       ...          if (buy)       {          Backtester.CancelationCode = 1; // 6, 11, ...          _transaction = PlaceTrade(bars, TransactionType.Buy, OrderType.Limit, ...);          _transaction.Weight = weight[index];       }    }    else    {       {          Backtester.CancelationCode = 2; // 7, 12, ...          if (exit)          {             ClosePosition(foundPosition0, OrderType.Market, ...);          }       }       {          Backtester.CancelationCode = 2; // 7, 12, ...          ClosePosition(foundPosition0, OrderType.Limit, ...);       }    }
0

Reply

Bookmark

Sort