last order price

 
how do i choose the last order price of current symbol?
 
if (LastHistOrderSelect(OP_BUY, OP_SELL)) Print(OrderOpenPrice());
 
bool LastHistOrderSelect(int type1, int type2)
{
  datetime tm = -1;
  int ticket = -1;
 
  int cnt = OrdersHistoryTotal();
  for (int i=0; i < cnt; i++) 
  {
    if (!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) continue;
    if (OrderSymbol() != Symbol()) continue;
    
    int type = OrderType();
    if (type == type1 || type == type2)
    {
      if (OrderCloseTime() > tm)
      {
        tm = OrderCloseTime();
        ticket = OrderTicket();
      }
    }
  }
  
  return (OrderSelect(ticket, SELECT_BY_TICKET, MODE_HISTORY));
}
Reason: