how can i get last order information from the function?

 
Hi, anyone can help me. how can i get last order information from the function? because below code only can get first information.
mean if i order 3. i want to get number 3 information, and the first and second no need information get it.

thanks

egt520

switch ( OrderType() )
{
case OP_BUY:
_BuyType = OrderType();
_BuyTicket = OrderTicket();
_BuyLots = NormalizeDouble( OrderLots(), Digits );
_BuyOpenPrice = NormalizeDouble( OrderOpenPrice(), Digits );
_BuyStopLoss = NormalizeDouble( OrderStopLoss(), Digits );
_BuyTakeProfit = NormalizeDouble( OrderTakeProfit(), Digits );
_BuyOpenTime = OrderOpenTime();
_BuyProfit = NormalizeDouble( OrderProfit(), 2 );
_BuySwap = NormalizeDouble( OrderSwap(), 2 );
_BuyCommission = NormalizeDouble( OrderCommission(), 2 );
_BuyComment = OrderComment();
break;
case OP_SELL:
_SellType = OrderType();
_SellTicket = OrderTicket();
_SellLots = NormalizeDouble( OrderLots(), Digits );
_SellOpenPrice = NormalizeDouble( OrderOpenPrice(), Digits );
_SellStopLoss = NormalizeDouble( OrderStopLoss(), Digits );
_SellTakeProfit = NormalizeDouble( OrderTakeProfit(), Digits );
_SellOpenTime = OrderOpenTime();
_SellProfit = NormalizeDouble( OrderProfit(), 2 );
_SellSwap = NormalizeDouble( OrderSwap(), 2 );
_SellCommission = NormalizeDouble( OrderCommission(), 2 );
_SellComment = OrderComment();
break;
 
Replace this line
    for ( int z = _OrdersTotal - 1; z >= 0; z -- )
with this
    for ( int z = 0; z < _OrdersTotal; z ++ )
 
very fast to reply.
thank komposter.

egt520