In my strategy I use an unmanaged approach to check if my order has been filled and to limit the number of trades per bar. Below is a snippet..
private IOrder entryOrder = null;
protected override void OnBarUpdate()
{
entryOrder = EnterLongLimit(0, true, DefaultQuantity, bidPrice, "MyStrategyOrder");
}
protected override void OnExecution(IExecution execution)
{
// Check if Order is Filled or Partially Filled
if (entryOrder != null && entryOrder == execution.Order)
{
thisBarTrades++;
}
If this working order is not filled, I would like to cancel the order after X amount of bars. I viewed examples of cancelling orders in the MANAGED APPROACH, but how does one cancel a working order in an unmanaged approach?
Thanks in advance
Comment