You can calculate the profit and loss using the formula below:
1. Calculating the difference between the open and close prices;
Difference between open and close price = (Open price-Close price) * 10^digit
Note : Digit = Decimal
2. Pip Value = ( ( Contract size x Lot) x 10^-digit ) /exchange rate
Note : Exchange rate is the rate of conversion from the Quote Currency to the Account Currency.
3. Pip Value*Difference between open and close price = Profit/loss, then the result must be calculated back to the pair corresponding to the currency
Example 1 open order buy 0.01 lot, GBPUSD pair, open price 1.35443, close price 1.35400, Contract size 100000, Point size or Digit = 5
1. Difference between open and close price= (Open price-Close price) * 10^digit
Difference between open and close price =(1.35443-1.35400)*10^5
= 43
2. Pip Value = ( ( Contract size x Lot) x 10^-digit ) /exchange rate
= (100000*0.01*0.00001)/1
= $0.01
3. Pip Values* Difference between open and close price = 43*0.01
Therefore, Profit and loss is $0.43
Example 2 Open order Buy 0.01 lot, EURCAD pair, open price 1.48452, close price 1.48431, Contract size 100000, Digits= 5
1. Difference between open and close price = (Open price-Close price) * 10^digit
Difference between open and close price =(1.48431-1.48452)*10^5
=-21
2. Pip Value = ( ( Contract size x Lot ) x 10^-digit ) /exchange rate
= ( ( 100000 * 0.01 ) x 10^-5 )/1.37
= $0.00729
3. Pip Values* Difference between open and close price = 0.00729*-21 = $-0.15
Therefore, Profit and loss is $-0.15
Example 3 Open order Sell 0.1 lot,Indices UK100, open price 7542.20, close price 7545.50, Contract size 1, Digits= 2
1. Difference between open and close price= (Open price-Close price) * 10^digit
Difference between open and close price = (7542.20-7545.50)*10^2
= -330
2. Pip Value = ( ( Contract size x Lot) x 10^-digit ) /exchange rate
Exchange rate 0.92
= ((1 x 0.1) x 10^-2) / 0.92
= $0.00108
3. Pip Values* Difference between open and close price =0.00108*330=-0.3564
Therefore, Profit and loss is $-0.35
Note : Please visit this link for profit and loss, Forex Pip Value, and Gold (XAUUSD) calculators.