double DifferencePositionMarket(int f_ticket) // ticket { for(int i=OrdersTotal()-1; i>=0; i--) if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES)) if(OrderTicket()==f_ticket) { int f_type=OrderType(); if(f_type==OP_BUYLIMIT || f_type==OP_SELLLIMIT || f_type==OP_BUYSTOP || f_type==OP_SELLSTOP) return DBL_MAX; //--- if(f_type==OP_BUY) return MarketInfo(OrderSymbol(),MODE_BID)-OrderOpenPrice(); if(f_type==OP_SELL) return MarketInfo(OrderSymbol(),MODE_ASK)-OrderOpenPrice(); } return DBL_MAX; }