Login Page - Create Account

Support Board


Date/Time: Sat, 30 Nov 2024 06:45:49 +0000



Post From: ACSIL: Attached Orders

[2022-12-17 22:20:30]
ondafringe - Posts: 286
I've been trying to figure this out for at least a week and haven't had any luck.

I need to place two market orders in rapid succession, each for two contracts... each order needs an attached OCO target and stop... both target and stop are for three points.

What I get is an open position with four contracts (that part works), but I only get one three-point target for two contracts and one three-points stop for two contracts (see attached image) attached to the first market order, but I don't get a target and stop on the second market order. If I let it run, when either the target or stop is hit, the other order cancels (that works), but I'm left with two open contracts that don't have a target or stop.

I have a work around I've been using that is far from ideal: I'm placing targets and stops individually for each order and then cancelling the remaining open orders once the target or stop is hit.
I really need to figured this out because in the future, I will need to place more than two orders in rapid succession.

I've gone over the documentation, tried a variety of things, but nothing worked. It just isn't clear to me what I need to do. If anyone knows how to accomplish this, I'd appreciate your input.

Here is what I am trying, but it doesn't give me that second set of attached OCO orders (again, see attached image):

sc.MaximumPositionAllowed = 100;
sc.AllowMultipleEntriesInSameDirection = true;
sc.SupportReversals = false;
sc.AlertOnlyOncePerBar = true;
sc.ResetAlertOnNewBar = true;
sc.AllowOppositeEntryWithOpposingPositionOrOrders = false;
sc.SupportAttachedOrdersForTrading = false;
sc.CancelAllOrdersOnEntriesAndReversals = true;
sc.AllowEntryWithWorkingOrders = true;
sc.CancelAllWorkingOrdersOnExit = false;
sc.AllowOnlyOneTradePerBar = false;
sc.MaintainTradeStatisticsAndTradesData = true;


s_SCNewOrder NewOrder;
NewOrder.OrderQuantity = 2;
NewOrder.OrderType = SCT_ORDERTYPE_MARKET;
NewOrder.TimeInForce = SCT_TIF_DAY;

NewOrder.Target1Offset = 3;
NewOrder.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT;

NewOrder.Stop1Offset = 3;
NewOrder.AttachedOrderStop1Type = SCT_ORDERTYPE_STOP;

for (int cnt = 1; cnt <= 2; cnt += 1)
{
     sc.BuyEntry(NewOrder);
}
imageDOM Snip.PNG / V - Attached On 2022-12-17 22:07:19 UTC - Size: 13.79 KB - 131 views