DislikedI received your code I have no idea what this is intended to do for(q=0; q<OrdersTotal(); q++) { if(OrderSelect(q,SELECT_BY_POS,MODE_TRADES) && OrderMagicNumber()==magic) { return; } } but what it means is that if the EA has an open order, then it returns from OnTick, so the code to delete the order cannot be executed. I suggestyed this as a possibility in post #8 Remove that block of codeIgnored