用 orderselect by pos 选择历史单的顺序是按tik 号排序，能不能按单子的平仓时间排序

259

for (int i=0;i<OrdersHistoryTotal() ;i++)

OrderSelect(i, SELECT_BY_POS,MODE_HISTORY);

12273

Create an array and copy into one the order list. Then sort this array as you want.
259

mq4支持多维排序吗？

12273

See sample

//+------------------------------------------------------------------+
//| returns sorted by TimeClose array of tickets                     |
//+------------------------------------------------------------------+
{
int i,counter;
int TicketAndTime[][2];
//----
ArrayResize(TicketAndTime,OrdersHistoryTotal());

for (i=0;i<OrdersHistoryTotal();i++)
{
if (OrderSelect(i,SELECT_BY_POS,MODE_HISTORY))
{
if (OrderType()<=OP_SELL)
{
TicketAndTime[counter][0]=OrderCloseTime();
TicketAndTime[counter][1]=OrderTicket();
counter++;
}
}
}
ArrayResize(TicketAndTime,counter);
ArrayResize(Tickets,counter);
ArraySort(TicketAndTime);
for (i=0;i<counter;i++)
{
Tickets[i]=TicketAndTime[i][1];
}
int err=GetLastError();

//----
return(counter);
}