how i can get the first ticket opned - page 2

 
William Roeder #:
  1. Of course, that doesn't work. Order is not a datetime, and OrderOpenTime will always be less than MAX_DATETIME.

  2. What part of "setting first to the maximum possible" was unclear?



maybe 2 days .. coz all my tread stay about 2 days ,, after its closing

 
William Roeder #:
What part of "setting first to the maximum possible" was unclear?
double firstOrderInfo(string Info,int type=-1)
  {
     for(int i=0; i<OrdersTotal();i++){
     if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
     if(OrderSymbol()==Symbol()&& OrderMagicNumber() == MagicNumber  &&  (OrderType()==type ||type==-1)){
       if(Info=="Type")      return(OrderType());
  else if(Info=="Lots")      return(OrderLots());
  else if(Info=="Price")     return(OrderOpenPrice());
   else if(Info=="Profit")     return(OrderProfit());
   else if(Info=="TP")     return(OrderTakeProfit());
   else if(Info=="Time")      return((int)OrderOpenTime());
  
  }
  }return(0);

}  

right now work corectly