Yes, I use nextValidId(), and then increment values myself, for example like this:
? long 3641 short 3721 tp 3722 sl 3723 tp long 3742 sl long 3743
I use tws Build 985.1k and api 9.85.1
I noticed there is another, possibly unrelated, problem which happens randomly. After placing all 6 orders, the first one is rejected with error:
Error, reqId:? 3641? errorCode: 201 Order rejected - reason:Cannot have open orders on both sides of the same US Option contract.
All child orders then also are rejected, since parent is missing. The instruments are options, and I didn't place any orders before for these specific contracts before. Does IB not understand the relationship between parent - child orders, and thinks that stop loss or take profit sell order would be an opposite side to initial buy order, and that is why it rejects initial buy order? There seems to be a lot of randomness involved, since the same contract combination works just fine after few retries.