Is there a method in NT8 to cancel all existing EntryOrders without creating a list of those orders? In NT7 CancelAllOrders() exists.
I think I can create a list of my existing orders and loop through that to cancel each order.
But I am looking for something like the following that closes a long position but that would cancel all existing orders:
if (some condition)
{
ExitLong("");
}
If there is not a similar method, does it matter if I cancel orders like this:
if (some condition)
{
CancelOrder(long1EntryOrder);
CancelOrder(long2EntryOrder);
CancelOrder(long3EntryOrder);
}
// and allowing the entry orders to be reset to null in OnOrderUpdate
Or is using the following code preferred to first check if the order exists before cancelling it?
if (long1EntryOrder != null)
{
CancelOrder(long1EntryOrder);
}
if (long2EntryOrder != null)
{
CancelOrder(long2EntryOrder);
}
if (long3EntryOrder != null)
{
CancelOrder(long3EntryOrder);
}
// while again allowing the orders to be reset to null in OnOrderUpdate as they are cancelled
Thank you for any help!
Comment