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); }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello, I wonder if i can use OrderMagicNumber() instead of OrderTicket() for closing the current position?