Support Board
Date/Time: Fri, 17 Jan 2025 21:55:42 +0000
Post From: ACSIL - Preventing a code block from running if Open or Active Orders.
[2025-01-17 00:28:57] |
User92573 - Posts: 541 |
Dear Support Please can you offer any guidance on the following. I'm trying to prevent the operation of some study code while Orders are Open or Active. Is this correct? bool IsOrderOpen = TradeOrder.OrderStatusCode == SCT_OSC_OPEN;
s_SCPositionData PositionData; sc.GetTradePosition (PositionData); if(PositionData.PositionQuantity != 1 && IsOrderOpen != 1) { // Flattened, No Position or Open Orders. } else { // Open or Pending Orders Present. } I just want to make sure this is correct and I'm trapping all possibilities as I've also got: s_SCTradeOrder TradeOrder;
sc.GetOrderByOrderID(r_InternalOrderID, TradeOrder); bool IsOrderOpen = TradeOrder.OrderStatusCode == SCT_OSC_OPEN; bool IsOrderFilled = TradeOrder.OrderStatusCode == SCT_OSC_FILLED; bool IsOrderUnspecified = TradeOrder.OrderStatusCode == SCT_OSC_UNSPECIFIED; bool IsOrderPendingCancel = TradeOrder.OrderStatusCode == SCT_OSC_PENDINGCANCEL; bool IsOrderCancelled = TradeOrder.OrderStatusCode == SCT_OSC_CANCELED; Many thanks. Date Time Of Last Edit: 2025-01-17 10:17:07
|