Support Board
Date/Time: Tue, 26 Nov 2024 06:39:56 +0000
[Programming Help] - OCO gets canceled after scaling out ASCIL
View Count: 166
[2023-12-29 08:28:47] |
User888583 - Posts: 20 |
Hi, I am working on ASCIL study that enters the trade with several OCO groups and once time comes, scale out one or more contracts out of it. For example: I go long 3 contracts with 3 respective TP/SL OCO groups: // during sc.SetDefaults sc.AllowMultipleEntriesInSameDirection = true; sc.AllowOnlyOneTradePerBar = false; sc.CancelAllWorkingOrdersOnExit = true; sc.AllowEntryWithWorkingOrders = true; // code to execute new trade s_SCNewOrder NewOrder; NewOrder.OrderQuantity = 3; NewOrder.OrderType = SCT_ORDERTYPE_MARKET; NewOrder.Symbol = SCString("ES"); NewOrder.Target1Offset = 3; NewOrder.AttachedOrderTarget1Type = SCT_ORDERTYPE_LIMIT; NewOrder.OCOGroup1Quantity = 1; NewOrder.Target2Offset = 4; NewOrder.AttachedOrderTarget2Type = SCT_ORDERTYPE_LIMIT; NewOrder.OCOGroup2Quantity = 1; NewOrder.Target3Offset = 5; NewOrder.AttachedOrderTarget3Type = SCT_ORDERTYPE_LIMIT; NewOrder.OCOGroup3Quantity = 1; Result = this->sierra.BuyEntry(NewOrder); I have one trade with 3 separate OCO for TP/SL. Now I want to reduce exposure, I am executing following code to take one trade: s_SCNewOrder NewOrder; NewOrder.OrderQuantity = 1; NewOrder.OrderType = SCT_ORDERTYPE_MARKET; NewOrder.Symbol = SCString("ES"); int Result = 0; Result = this->sierra.BuyExit(NewOrder); // returns 1 I am not sure what I am doing wrong here or which API I should use instead if I want to scale out keeping OCO. |
To post a message in this thread, you need to log in with your Sierra Chart account: