It seems that my existing order entry code doesn't seem to work anymore in 1.1 but did in 1.0. I wrote a quick system that just buys or sells every bar to verify. OpenPosition(...) works fine but PositionOrder does nothing (at IB TWS). Actually, just tried with paperbroker and same result. Whats changed?

You should check the return value of OpenPosition to see if it succeeded. If it did not (which I think is most likely), check the Message property for the reason it failed. The following code demonstrates how to do this.

if (!retVal.Success){ // Add message to output window with the reason the position could not be opened SystemData.Output.Add(OutputSeverityLevel.Warning, retVal.ReturnCode.Message, symbol);}else{ string ID = retVal.Value; // Store or process position ID here, if necessary

dplaisted (1/24/2008)You should check the return value of OpenPosition to see if it succeeded. If it did not (which I think is most likely), check the Message property for the reason it failed. The following code demonstrates how to do this.

if (!retVal.Success){ // Add message to output window with the reason the position could not be opened SystemData.Output.Add(OutputSeverityLevel.Warning, retVal.ReturnCode.Message, symbol);}else{ string ID = retVal.Value; // Store or process position ID here, if necessary

}

Thanks,Daniel

I never had a problem with OpenPosition(symbol,xx,xxx,xxx) but rather with OpenPosition(PositionOrder), so I tried to get the return string if pass or fail and oddly enough RE doesn't flag a fail at all. So I output to screen both cases to make sure the Return Code exists. Sure enough RE thinks it has sent the order but I get nothing. Here is the code:

Made a mistake with the sample broker test system, the capital was set too low. So Paper Broker does correctly accept and execute orders but the initial problem remains, IB doesn't receive anything (which worked in 1.0 but not 1.1). The Live System Window shows no orders on any pane and TWS shows no orders. Also, OpenPosition(PositionOrder) doesn't return a fail....

As you know OpenPosition(PositionOrder) is the only way to send an order without having it timed out on every bar. At the moment Re doesn't send anything to TWS even though it thinks it has. So how can I send orders thru RE to IB (i.e. is there a workaround)?

When you use OpenPosition(symbol,xx,xxx,xxx), does the order get sent to IB (and then of course get cancelled the next time a bar comes in)?

The other OpenPosition methods just create a PositionOrder object and pass it to OpenPosition(PositionOrder). So I'm not sure what the problem is but hopefully we can figure it out.

You are declaring your PositionOrder variable as a member of your class, and reusing the same one each time you call OpenPosition. I don't see any reason this would cause a problem, but try moving the following line to the start of your SetupOrderToOpen() method:

PositionOrder Order = new PositionOrder();

Are you using the new C# TWS plugin, or the old one that uses ActiveX?

Have you looked at the TWS log files to see if there is any error information in them? They should be located in your TWS installation directory (C:\Jts probably) under the names log.Mon.txt, log.Tue.txt, etc.