Very Important Function

 

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);
}
 

If you search https://www.mql5.com/en/search#!keyword=migration%20mql4%20mql5&module=mql5_module_articles.

And this as well: Library MT4-Orders for MetaTrader 5  https://www.mql5.com/en/code/16006
You can easily do it I guess ..