Support Board
Date/Time: Thu, 06 Feb 2025 17:08:04 +0000
[Programming Help] - sc.GetOrderByOrderID
View Count: 596
[2020-04-29 01:19:28] |
User701453 - Posts: 176 |
When using the sc.GetOrderByOrderID function. It causes the persistent variable "EntryOrderID" to increase by one number.ie 27035 will increase to 27036 Which of course will cause the "IsWorkingOrderStatus" to always be false. I have debugged with VS and using the "locals" window and break point after the function call, I can see when the value changes and its always after the call of the "sc.GetOrderByOrderID". Current SC version 2092 s_SCTradeOrder ExistingOrderDetails; if (sc.GetOrderByOrderID(EntryOrderID, ExistingOrderDetails)) { if (IsWorkingOrderStatus(ExistingOrderDetails.OrderStatusCode)) { if (EntryOrderID > 0 && sc.Index >= BarIndexOfOrder + Bars_Limit_Cancel.GetInt()) { sc.FlattenAndCancelAllOrders(); } } } |
[2020-04-29 05:38:36] |
Flipper - Posts: 65 |
When using the sc.GetOrderByOrderID function.
It causes the persistent variable "EntryOrderID" to increase by one number.ie 27035 will increase to 27036 No it shouldn't. Are you sure you are using the right variable? s_SCTradeOrder ExistingOrderDetails;
SCString TestString; TestString.Format("EntryOrderID step1: %d", EntryOrderID); sc.AddMessageToLog(TestString, 0); if (sc.GetOrderByOrderID(EntryOrderID, ExistingOrderDetails)) { TestString.Format("EntryOrderID step2: %d", EntryOrderID); sc.AddMessageToLog(TestString, 0); if (IsWorkingOrderStatus(ExistingOrderDetails.OrderStatusCode)) { if (EntryOrderID > 0 && sc.Index >= BarIndexOfOrder + Bars_Limit_Cancel.GetInt()) { sc.FlattenAndCancelAllOrders(); } } } Chart: Replay 60X: F.US.HSIK20 [CV] 1 min #1 | Study: TEST_System | EntryOrderID step1: 23284 | 2020-04-29 15:33:52.358
Chart: Replay 60X: F.US.HSIK20 [CV] 1 min #1 | Study: TEST_System | EntryOrderID step2: 23284 | 2020-04-29 15:33:52.358 Date Time Of Last Edit: 2020-04-29 05:47:43
|
[2020-04-29 08:51:27] |
User701453 - Posts: 176 |
No it shouldn't. Are you sure you are using the right variable? What version of SC are you using? I can see the value change in local when I step into the break point. Code block below when i set the persistent variable value. I have used the code blocks before in previous strats and it has worked as expected. if (Result > 0) { // Remember the order IDs for subsequent modification and cancellation EntryOrderID = NewOrder.InternalOrderID; Target1OrderID = NewOrder.Target1InternalOrderID; Target2OrderID = NewOrder.Target2InternalOrderID; Target3OrderID = NewOrder.Target3InternalOrderID; Stop1OrderID = NewOrder.Stop1InternalOrderID; Stop2OrderID = NewOrder.Stop2InternalOrderID; StopAllOrderID = NewOrder.StopAllInternalOrderID; BarIndexOfOrder = sc.Index; sc.AddMessageToLog(sc.GetTradingErrorTextMessage(Result), false); } |
[2020-04-30 10:48:30] |
Flipper - Posts: 65 |
What version of SC are you using?
Version 2086 & lower |
To post a message in this thread, you need to log in with your Sierra Chart account: