Support Board
Date/Time: Fri, 29 Nov 2024 02:33:27 +0000
Post From: canceled stop order continues to have status SCT_OSC_OPEN
[2023-02-17 15:09:35] |
Berliner JFK - Posts: 45 |
I have an automated trading system that uses stop orders regularly, and so is constantly creating them and canceling them. For error checking purposes, my code always remembers the last created and canceled stop order ID's and compares them with the open / canceled stop orders ID's from the Sierra Chart trade orders list: // code queries trade orders list to find the last open stop order
while(sc.GetOrderByIndex(StopIndex, StopOrderData) != SCTRADING_ORDER_ERROR) { StopIndex = StopIndex + 1; int StopOrderStatusCode = StopOrderData.OrderStatusCode; int StopOrderTypeAsInt = StopOrderData.OrderTypeAsInt; if ((StopOrderStatusCode == SCT_OSC_OPEN) && (StopOrderTypeAsInt == 2)) StopInternalOrderID = StopOrderData.InternalOrderID; } // code queries trade orders list to find the last canceled stop order ID
while(sc.GetOrderByIndex(CancelIndex, CancelOrderData) != SCTRADING_ORDER_ERROR) { CancelIndex = CancelIndex + 1; int CancelOrderStatusCode = CancelOrderData.OrderStatusCode; int CancelOrderTypeAsInt = CancelOrderData.OrderTypeAsInt; if ((CancelOrderStatusCode == SCT_OSC_CANCELED) && (CancelOrderTypeAsInt == 2)) CancelInternalOrderID = CancelOrderData.InternalOrderID; } What's happening is that my system finds the same stop order ID both as "SCT_OSC_OPEN" and "SCT_OSC_CANCELED" and reports a mismatch. When I catch the error and look in the trade orders window, the stop order always shows "Canceled". The trade activity log also shows that the stop order was properly canceled, seconds after the cancel order was placed. Therefore I can detect no reason why the code finds it with the status "SCT_OSC_OPEN". Can you please tell me why this is happening? FWIW this is simulated trading. Thanks! Date Time Of Last Edit: 2023-02-17 16:41:52
|