int GetOrderTicket(string f_symbol="", // instrument finansowy int f_cmd=-1, // typ orderu int f_magic=-1) // identyfikator { for(int i=OrdersTotal()-1; i>=0; i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if((f_symbol==OrderSymbol() || f_symbol=="") && (f_cmd ==OrderType() || f_cmd==-1) && (f_magic ==OrderMagicNumber() || f_magic==-1)) return OrderTicket(); return -1; }