Support Board
Date/Time: Sat, 30 Nov 2024 04:40:33 +0000
[Programming Help] - ACSIL: Attached Orders
View Count: 968
[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); } |
DOM Snip.PNG / V - Attached On 2022-12-17 22:07:19 UTC - Size: 13.79 KB - 130 views |
[2022-12-18 11:17:42] |
User431178 - Posts: 545 |
You need to set sc.CancelAllOrdersOnEntriesAndReversals to false - Automated Trading Management: CancelAllOrdersOnEntriesAndReversals The target/stop orders for the first entry are cancelled when the second entry is submitted. |
[2022-12-18 14:35:29] |
ondafringe - Posts: 286 |
Finally!! That worked perfectly!! I really appreciate your help. Thank you! :) |
To post a message in this thread, you need to log in with your Sierra Chart account: