Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 06:52:10 +0000



Post From: SCT_ORDERTYPE_OCO_BUY_STOP_SELL_STOP question

[2014-04-11 03:28:57]
onnb - Posts: 662
You can set the Target and Stop as price values. For example, for the target you would use the Target1Price member.

I would need to have Target1Price for the Sell order and Target1Price for the buy order which I don't think is available in the api - just want to confirm I am not missing anything?

Looking at the api, I see that I would need to do something like this where I set the target1/stop1 fields after calling SubmitOCOOrder:

s_SCNewOrder NewOrder;
NewOrder.OrderQuantity = 4;
NewOrder.OrderType = SCT_ORDERTYPE_OCO_BUY_STOP_SELL_STOP;

NewOrder.Price1 = Last + 10 * sc.TickSize;
NewOrder.Price2 = Last - 10 * sc.TickSize;

// Optional: Add target and stop Attached Orders to each stop in the OCO pair.
NewOrder.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;
NewOrder.Target1Offset = 4 * sc.TickSize;
NewOrder.AttachedOrderStop1Type = SCT_ORDERTYPE_STOP;
NewOrder.Stop1Offset = 4 * sc.TickSize;

if ( sc.SubmitOCOOrder(NewOrder) >0)
{

int BuyStopOrderID = NewOrder.InternalOrderID;
int SellStopOrderID = NewOrder.InternalOrderID2;

// modify the target and stop of both the orders
s_SCNewOrder order;
order.InternalOrderID = BuyStopOrderID;
order.Target1Price = 110;
order.Stop1Price = 90;
sc.ModifyOrder(order);

order.InternalOrderID = SellStopOrderID;
order.Target1Price = 40;
order.Stop1Price = 60;
sc.ModifyOrder(order);

}


I'm first trying to verify that I need to modify the target/stop of each OCO like this or not. I have a follow up question based on the answer to this.