orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, limitLevel, 0,
TimeInForce.Gtc, GetAtmStrategyUniqueId(), atmName,
orderId);
limitCloseBars = CurrentBars[1] + unfilledBars;
then after x amount of bars if the order isn't filled, I try to close it using this code:
if(CurrentBars[1] >= limitCloseBars)
{
closeEntry = true;
}
if(closeEntry == true)
{
// string[] entryInfo = GetAtmStrategyEntryOrderStatus(orderId);
// if(entryInfo.Length > 0 && entryInfo[2] != "Filled")
// {
AtmStrategyCancelEntryOrder(orderId);
// }
closeEntry = false;
}
if i delete the // then AtmStrategyCancelEntryOrder(orderId); is never called. Even with the code like this my order isn't cancelled. I even put
AtmStrategyCancelEntryOrder(orderId); as the first line of code under OnBarUpdate and it still would not cancel the order. What am I doing wrong?
Comment