Very Important Function

Ahmed Abd El Aziz  

Hello,

This is MQL4 function, I need to use this function in MQL5. Is there easy way to enable me to know the roles to do this?


double LastClosedInfo(string S, int type = -1)
{
for(int i = OrdersHistoryTotal() - 1; i >= 0; i--)
if(OrderSelect(i, SELECT_BY_POS, MODE_HISTORY))
if(OrderSymbol() == Symbol()
&& OrderMagicNumber() == MagicNumber
&& (OrderType() == type || type == -1))
{
if(S == "Lots") return(OrderLots());
else if(S == "OpenPrice") return(OrderOpenPrice());
else if(S == "ClosePrice") return(OrderClosePrice());
else if(S == "OpenPrice") return(OrderOpenPrice());
else if(S == "TP") return(OrderTakeProfit());
else if(S == "SL") return(OrderStopLoss());
else if(S == "Type") return(OrderType());
else if(S == "Profit") return(OrderProfit());
else if(S == "OpenTime") return(OrderOpenTime());
else if(S == "CloseTime") return(OrderCloseTime());
else if(S == "Com") return(OrderCommission());
else if(S == "Swap") return(OrderSwap());

}
return(0);
}
Reason: