Support Board
Date/Time: Tue, 13 May 2025 00:02:02 +0000
Post From: Automated trading issues canceling or modifying orders
[2016-02-25 01:49:55] |
flyboy615 - Posts: 56 |
ok I now have had time to debug further. It would seem that the functionality surrounding the GetOrderByOrderID may be the cause. Prior to the upgrade when the order was open on the screen the order status would identify the order as SCT_OSC_OPEN. The same code in the same situation now shows the ShortPosition.OrderStatusCode = SCT_OSC_FILLED. I have a valid order id stored in a Persist var. Here is a stripped down version covering the essentials. there is a lot of code between the steps but gives my basic logic. The example int& ShortOrderId = sc.PersistVars->Integers[11]; s_SCTradeOrder ShortPosition; //place the short order ReturnInd = sc.SellEntry(ShortOrder); if(ReturnInd > 0 ) { ShortOrderId = ShortOrder.InternalOrderID; // set the ID } else{ ShortOrderId = 0; } //later in the process verify the status int intSOrder = sc.GetOrderByOrderID(ShortOrderId,ShortPosition); if (ShortPosition.OrderStatusCode == SCT_OSC_OPEN && bCancelOrder) { sc.CancelOrder(ShortOrderId); } I may have misused something in the beginning that suited the purpose at that time and now has been fixed but this logic had been functional for several years. Thanks |