Delete and Re-submit order

Hi, 


My purpose with this function is to delete and re-submit my strategies order if market keep closing below/above my former STP-entry price. This is only for pending orders. 


It seems nothing happens from this code which confuses me. Anyone have any idea why it wont delete and re-enter pending order?

for (int i = OrdersTotal() - 1; i >= 0; i --) 
      {
         if (OrderSelect(i, SELECT_BY_TICKET, MODE_TRADES))

You must select by position, not ticket.

Keith Watford:

You must select by position, not ticket.

Thank you Keith