Profile Picture

Unexpected order cancel with IB

Posted By pxlafrip 6 Years Ago
Posted Sunday February 10 2013

I have been using RE and IB for my live automated trading for several weeks and everything was working fine.
However, last friday when I restarded my trading system live I had the following message:

Unexpected order cancel: OpenPosition: 375: Market Short EUR/USD 0/100000 - Rejected - Open Position IB error/warning 321: Error validating request:-'rc' : cause - GoodTilDate field is only valid with time-in-force of GTD.

The weird thing is that I changed nothing in my settings either in IB or on RE and if I try on another computer, the message remain the same.

Could anyone provide help on this issue ?

Many thanks
Posted Sunday February 10 2013
If you are using Visual Studio, placing a breakpoint in SubmitOrder of the TWSPlugin will help track down where the problem is coming from. I've had issues in the past with submitting orders to IB.

Note, sometimes IB changes their back-end systems which can affect your orders via the plugin.

Posted Monday February 11 2013

thank you for your help.
I am indeed using visual studio but I'm not an expert.
I have added a reference to TWSCSharpPlugin and I can see the SubmitOrder function but only in the object browser, how do I set a break point on this ?

Posted Monday February 11 2013
see the following:

Posted Monday February 11 2013

what I meant is that I don't see what's inside TWSCSharpPlugin and thus cannot put a breakpoint on the function SubmitOrder.
How can I debug into TWSCSharpPlugin ?

Posted Monday February 11 2013
you need to add the project to your solution. Project is located in your AppData\Roaming\Yye Software\RightEdge\2010.1.0.0\Samples\RightEdgePlugins.

Then rebuild, and copy the dll and pdb file to the C:\Program Files (x86)\Yye Software\RightEdge 2010\Plugins folder.

Then start RightEdge and attach VS to RightEdge process.

The symbols for the TWSPlugin should be loaded and you will be able to place a breakpoint.


Edited: Monday February 11 2013 by alpha23
Posted Tuesday February 12 2013
Problem solved.
Thank you for your valuable help.
If anyone has the same issue, the answer is simply to comment this line in TWSPlugin.cs

apiOrder.GoodTillDate = "GTC";

Edited: Tuesday February 12 2013 by pxlafrip
Posted Tuesday April 16 2013
I upgraded to the last TWS version (937.2) yesterday and got exactly the same problem!! Your solution works fine !! Thank you!, you have saved me from a lot of time and frustation Smile
Posted Monday October 21 2013
Yesterday I tried to go live with REb48 and TWS 936.9i (14Aug13) ran into this problem. (interesting that my TWS version is lower than yours (937.2 as at 17Apr13)... Blink perhaps it has been rolled back?)

I know that this has been fixed in REb49. But does anyone know what exactly has happened to cause the problem?

Fix possible issue with IB orders getting rejected with message: Rejected - Long Entry IB error/warning 321: Error validating request:-'rc' : cause - GoodTilDate field is only valid with time-in-force of GTD

Edited: Monday October 21 2013 by smersh
Posted Monday October 21 2013
Previously, the GoodTillDate of an order was set to "GTC" for GoodTillCanceled orders. Now, it is set to an empty string.

if (order.GoodTillCanceled)
   apiOrder.GoodTillDate = string.Empty;
   apiOrder.Tif = TimeInForce.GoodTillCancel;


Similar Topics

Reading This Topic

2005-2019 © RightEdge Systems