I am using the AtmStrategyChangeEntryOrder() so that if i miss an entry, the entry order will be submitted on the next bar's closing price. But once a trade is filled i want it to cancel changing my entry order, any suggestions on how i can cancel AtmStrategyChangeEntryOrder() once an order is filled?
if(LongSetUp == true
&& orderId.Length == 0 && atmStrategyId.Length == 0)
{
atmStrategyId = GetAtmStrategyUniqueId();
orderId = GetAtmStrategyUniqueId();
AtmStrategyCreate(OrderAction.Buy, OrderType.Limit, Close[0], 0, TimeInForce.Gtc, orderId, "NQ",atmStrategyId);
AtmStrategyChangeEntryOrder(Close[0], 0, orderId);
//How to stop this from submitting an order after each close
//reset the longsetup once filled or keep chasing it
if (orderId.Length > 0)
{
string[] status = GetAtmStrategyEntryOrderStatus(orderId);
// If the status call can't find the order specified, the return array length will be zero otherwise it will hold elements
// Check length to ensure that returned array holds order information
if (status.GetLength(0) > 0)
{
// If the order state is terminal, reset the order id value
if (status[2] == "Filled" || status[2] == "Cancelled" || status[2] == "Rejected")
{
LongSetUp = false;
AtmStrategyCancelEntryOrder(orderId);
}
}
//reset it once order is "FILLED" not submitted
}
}

Comment