The profit and loss of a trade is first calculated in the instrument's quote currency (the second currency in a currency pair): profit/loss for a buy order = (closing price − opening price) × contract size × lots, and profit/loss for a sell order = (opening price − closing price) × contract size × lots. If the quote currency differs from the account currency, the system converts it into the account currency at the exchange rate at that time. The profit and loss displayed in MT4/MT5 is already the converted amount.