Support Board
Date/Time: Sat, 23 Nov 2024 23:40:29 +0000
Post From: Error with Sim Lock & Orders being executed
[2024-07-03 17:12:46] |
ForgivingComputers.com - Posts: 960 |
As has been stated, you cannot flatten or cancel after you lock trading. Something else to consider is to avoid errors. You don't want to flatten if already flat, and you don't want to cancel orders if none exist, as these will cause errors with the trading service. So, check that orders exist before canceling, and check that there is a position before flattening. s_SCPositionData PositionData;
sc.GetTradePosition(PositionData); if (PositionData.PositionQuantity != 0) { sc.FlattenAndCancelAllOrders(); } else if (PositionData.WorkingOrdersExist) { sc.CancelAllOrders(); } |