Support Board
Date/Time: Fri, 29 Nov 2024 02:33:02 +0000
Post From: canceled stop order continues to have status SCT_OSC_OPEN
[2023-03-16 22:06:25] |
Berliner JFK - Posts: 45 |
Thank you, @ondafringe. Here is the code before: // BASE LEVEL
int Index = 0; // THIS IS THE PROBLEM VARIABLE (StopOrderID) int StopOrderID; s_SCTradeOrder Data; // SCAN FOR OPEN STOP ORDERS while(sc.GetOrderByIndex(Index, Data) != SCTRADING_ORDER_ERROR) { // IN SCOPE Index = Index + 1; int StatusCode = Data.OrderStatusCode; int TypeAsInt = Data.OrderTypeAsInt; if ((StatusCode == SCT_OSC_OPEN) && (TypeAsInt == 3)) // SAVE OPEN STOP ORDER ID AS StopOrderID StopOrderID = Data.InternalOrderID; } Here is the code after: // BASE LEVEL
int Index = 0; // ***ONLY CHANGE IS EXPLICIT DEFINIION "= 0", PROBLEM SOLVED*** int StopOrderID = 0; s_SCTradeOrder Data; // SCAN FOR OPEN STOP ORDERS while(sc.GetOrderByIndex(Index, Data) != SCTRADING_ORDER_ERROR) { // IN SCOPE Index = Index + 1; int StatusCode = Data.OrderStatusCode; int TypeAsInt = Data.OrderTypeAsInt; if ((StatusCode == SCT_OSC_OPEN) && (TypeAsInt == 3)) // SAVE OPEN STOP ORDER ID AS StopOrderID StopOrderID = Data.InternalOrderID; } The variable StopOrderID was declared at the base level (int StopOrderID;), but not defined (int StopOrderID = 0;). I thought that by declaring it at the base level, it would be "destroyed", but only the explicit definition worked. That's all I know, and the solution works. I imagine the question is "Why did the simple declaration (int StopOrderID;) at the base level not "destroy" the variable, instead requiring an explicit definition (int StopOrderID = 0;)? Date Time Of Last Edit: 2023-03-16 22:08:59
|