Login Page - Create Account

Support Board


Date/Time: Fri, 01 Nov 2024 01:23:20 +0000



Post From: Problem with OCO bracket entry orders

[2017-05-19 17:40:04]
Al SC Developer - Posts: 434
I am seeing intermittent issues with OCO bracket entry orders. I am building a simple buy and sell stop bracket with target and stop.

Generally they are working as expected, but occasionally the second side is not canceled when the first side is filled. This results in a position along with a pending set of orders for the opposite direction that should have been canceled on the fill.

The following is the code being used to submit the order:


// all trading vars are set at defaults

s_SCNewOrder NewOrder;

NewOrder.OrderType = SCT_ORDERTYPE_OCO_BUY_STOP_SELL_STOP;
NewOrder.TimeInForce = SCT_TIF_GTC;
NewOrder.OrderQuantity = 1;
NewOrder.Price1 = LongLevel + sc.TickSize;
NewOrder.Price2 = ShortLevel - sc.TickSize;
NewOrder.Target1Offset = 5 * sc.TickSize;
NewOrder.Target1Offset_2 = 5 * sc.TickSize;
NewOrder.Stop1Price = ShortLevel - sc.TickSize;
NewOrder.Stop1Price_2 = LongLevel + sc.TickSize;
NewOrder.OCOGroup1Quantity = 1;

rc = sc.SubmitOCOOrder(NewOrder);

I am seeing this in the latest ver 1558, and it happens both with live data (sim mode) and when replayed back using accurate backtest mode.

Nothing is generated in the log or the trade service log. From the order of the entries in the trade activity log, it looks like the order is immediately filled, before the second order is sent. I have attached the trade activity log for a trade immediately after the initial fill.
Date Time Of Last Edit: 2017-05-19 17:42:58
Private File