thank you for your example regarding the following discussion "Resume Historical Orders in Strategy- Unmanaged Approach" here:
I open a new Thread since it is not possible to post any reply in the previous one.
I am not sure I can apply your example to my strategy. If I understand it correclty you are submitting orders using the following commands in the OnBarUpdate() method:
if (shortEntry == null)
SubmitOrderUnmanaged(0, OrderAction.SellShort, OrderType.Limit, 100, High[0]+EntryDistance*TickSize, 0, oco, "Short limit entry");
if (longEntry == null)
SubmitOrderUnmanaged(0, OrderAction.Buy, OrderType.Limit, 100, Low[0]-EntryDistance*TickSize, 0, oco, "Long limit entry");
while being in Historical state. As soon the state becomes Realtime you check that the last orders placed in OnBarUpdate() are matching with the one provided by GetRealtimeOrder(Order) in state Realtime in OnStateChange() method. If they match they are assigned to the respective variables. Correct?
Now, my approach is a little bit different since I hava a semiautomated strategy. The strategy is only placing TPs and SLs (i.e. 1 SL and 3 TPs). I decide when to place a Buy/Sell order based on some conditions.
There is not historical Buy/Sell order placed by the strategy. So, when I place the order and then I disable the strategy and re-enable it again there will be no historical order and the strategy cancels my order as soon as it restarts as expected.
So, I would like to be able to "read" the orders available on the chart and implement a logic to match them with my orders in strategy. Is that possible?
Thank you.
Comment