Login Page - Create Account

Support Board


Date/Time: Tue, 21 May 2024 01:22:20 +0000



Post From: SCT_ORDERTYPE_OCO_BUY_STOP_SELL_STOP Order not setting attached stops correctly

[2017-01-16 14:48:10]
Al SC Developer - Posts: 434
When an OCO order of type SCT_ORDERTYPE_OCO_BUY_STOP_SELL_STOP is submitted, the attached order stops are not always properly set. When the Stop1Price/Stop1Price_2 fields are used, the Stop1Price is used for the attached stop order for both OCO groups. When the Stop1Offset/Stop1Offset_2 fields are used, both stops are properly set.

Here is an example of an order that produces incorrect orders:


s_SCNewOrder NewOrder;
    
NewOrder.OrderType = SCT_ORDERTYPE_OCO_BUY_STOP_SELL_STOP;
NewOrder.TimeInForce = SCT_TIF_GTC;
NewOrder.OrderQuantity = 2;
NewOrder.OCOGroup1Quantity = 1;
NewOrder.OCOGroup2Quantity = 1;

NewOrder.Price1 = LongEntryPrice;
NewOrder.Price2 = ShortEntryPrice;

NewOrder.Target1Offset = Target1OffsetInTicks * sc.TickSize;
NewOrder.Target2Offset = Target2OffsetInTicks * sc.TickSize;
NewOrder.Target1Offset_2 = Target1OffsetInTicks * sc.TickSize;
NewOrder.Target2Offset_2 = Target2OffsetInTicks * sc.TickSize;

// these work
//NewOrder.Stop1Offset = LongStopOffsetInTicks * sc.TickSize;
//NewOrder.Stop2Offset = LongStopOffsetInTicks * sc.TickSize;
//NewOrder.Stop1Offset_2 = ShortStopOffsetInTicks * sc.TickSize;
//NewOrder.Stop2Offset_2 = ShortStopOffsetInTicks * sc.TickSize;

// these fail, only using the first price for both groups
NewOrder.Stop1Price = LongStopPrice;
NewOrder.Stop2Price = LongStopPrice;
NewOrder.Stop1Price_2 = ShortStopPrice;
NewOrder.Stop2Price_2 = ShortStopPrice;
//NewOrder.StopAllPrice = LongStopPrice;
//NewOrder.StopAllPrice_2 = ShortStopPrice;