How to Use OrderMagicNumber() instead of OrderTicket() for closing the current position?
Magic number is not unique. Only the ticket number is unique and identifies the order.
Ahmed Abd El Aziz: I wonder if i can use OrderMagicNumber() instead of OrderTicket() for closing the current position?
Of course not.
@William Roeder "Please say something useful or be silent" :)
I found the solution at this function:
int OrderTicketInfo(int Mgic_Number) { for(int i = OrdersTotal() - 1; i >= 0 ; i--) { if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) if(OrderSymbol() == Symbol() && OrderMagicNumber() == Mgic_Number) { return (OrderTicket()); } } return(0); }
Hello, I wonder if i can use OrderMagicNumber() instead of OrderTicket() for closing the current position?