Last trade profit/loss? - page 2

Ah-Ong
10
Ah-Ong  
	string Last;
	
	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";
		break;
	}
	Print("Last Order is ",Last,", Symbol: ",OrderSymbol()," Profit / Loss: ",OrderProfit());