Support Board
Date/Time: Wed, 27 Nov 2024 10:43:55 +0000
Post From: ASCIL Different OrderIDs for Same Order
[2023-08-21 13:20:28] |
Gradient - Posts: 89 |
This is a completely different code block than before. The prior code block was logic to cancel stale orders. The aforementioned block initiates those orders when a trade has taken place. The block below shows that these order ids (i.e. LongOrderId and ShortOrderId) are declared but not initialized until the prior mentioned conditions are met. As shown and stated in the prior reply, Order IDs are not being set until those three conditions are met. If no trade has taken place with a response > 0 there will be no LongOrderId or ShortOrderId. Order Ids being declared below: //trading policy int policy=GetTradingPolicy(sc); bool drawdown_met=GetDrawdown(sc); sc.AllowOnlyOneTradePerBar=true; //variables to track elapsed time of sent orders int ExecutionMinute; int CurrentMinute = sc.BaseDateTimeIn[sc.Index].GetMinute(); SCString CurrentMinuteString; SCString ExecutionMinuteString; CurrentMinuteString.Format("Current Minute %d",CurrentMinute); sc.AddMessageToLog(CurrentMinuteString,1); //display entries and exits on main graph instead of subgraph sc.GraphRegion=0; //current time SCDateTime CurrentTime=sc.CurrentSystemDateTime; SCDateTime ReplayTime=sc.CurrentDateTimeForReplay; SCDateTime CurrentBarTime=sc.BaseDateTimeIn.TimeAt(sc.Index); SCDateTime ExecutionTime; //variables to store order ids int LongOrderId; int ShortOrderId; bool IsOrderFilled; SCString LongOrderIdString; SCString ShortOrderIdString; LongOrderIdString.Format("Long Order Id: %d",LongOrderId); ShortOrderIdString.Format("Short Order Id: %d",ShortOrderId); sc.AddMessageToLog(LongOrderIdString,1); sc.AddMessageToLog(ShortOrderIdString,1); |