for(int i = OrdersHistoryTotal() - 1; i >= 0; i--)
if(!OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)) continue;
if(OrderSymbol() != Symbol()) continue;
if(OrderProfit() == 0) continue; // Skip pending order. The profit of Cancelled pending order is zero.
if(OrderProfit() > 0) Last = "Profit";
if(OrderProfit() < 0) Last = "Loss";
Print("Last Order is ",Last,", Symbol: ",OrderSymbol()," Profit / Loss: ",OrderProfit());
Please enable the necessary setting in your browser, otherwise you will not be able to log in.