Are you looking at the OrderUpdated function? This may be providing some clues. Our order IDs are sequential and do not care if the order was successfully placed or not. It's simply a way to match things up later.
If OrderUpdated isn't being called or yielding any clues, the next step would be to look at the plugin itself. I'm not sure if you're running your system in Visual Studio, but there are Trace.WriteLine's in the plugin code that should spit out internal messages that may also yield clues.
Finally, is something relatively recent?
Zora (7/12/2010)
I see strange behavior when placing orders for a live system using RE2010 and TWS (Build 894.4). Shortly after starting, my system places limit orders for a number of stocks - sometimes in the tens - by calling SymbolScriptBase.OpenPosition for each one. All of the position parameters are defined in a PositionSettings object. The problem is that some of the orders placed this way vanish after being placed in RE. After calling OpenPosition, the error property of the returned Position is null, the position´s state is pending and the event handler for the OrderSubmitted event is triggered, allowing me to check the order id by printing it to a log. However, the order does not appear in the API tab of TWS like a successfully placed order should. There is also no mention of the order in the TWS xml audit file.
This problem does not affect all orders placed, but only the first few that are placed within several second of system startup. Subsequent orders placed using the same method are processed correctly and show up in TWS.
There is also a sudden jump in order id values between the "vanishing" orders and ones that placed correctly, i.e. the order id of the last order that vanished may be 20 and the order id of the next order (first correctly placed order) may be 29711.
All of this leads me to believe that the orders are getting lost somewhere before reaching TWS. This is a serious problem, preventing my system from working consistently. Do you have any idea what could be wrong? Can you suggest a way to track more closely what happens to an order sent from RE? Can you also describe how order id's are assigned?
Thank you!