There’s a rather nasty “gotcha” that one has to look out for when working with MetaTrader. It’s to do with iterating through a list of orders when you’re actually making changes to the order list. Take a look at this code to cancel all pending open orders. void CancelOpenOrders(){ […]