How is Profit&Loss of position calculated?

In most cases, orders get executed at the Ask and Bid prices. They are displayed in the Order Panel and on the Buy and Sell buttons in the top left corner:

 

Also, it is possible to enable their labels on the price scale by making right-mouse click→ labels:

 

Buy orders are executed at the Ask price, and Sell orders at the Bid price. The Last price on the chart does not affect the calculation. 

To close a long position, it is necessary to place a sell market order, so the Profit&Loss will be calculated as the distance between the Bid price and Entry Price multiplied by quantity. 

Thus, the formula for a long position is: 

 (Bid price - Average Fill Price)*quantity. 

The formula for a short position, on the contrary, will be calculated from the Ask price:

(Average Fill Price - Ask price)*quantity.

Here is an example of P&L calculation for the long position: 

(25882.18 - 25882.19)*10 = 0.10 USDT, which is around 0.10 USD.

 

Kindly note that P&L is calculated in the symbol's currency and then converted to USD, as the dollar is a default currency of the Paper Trading account balance. 

As for futures, the formulas are a bit different, as they take into calculation the point value of the contract. This information can be seen in the symbol info of the ticker by clicking on the three dots in its description:

 

Hence, the following formulas are used to calculate P&L on futures.

For long positions: 

(Bid price - Average Fill Price)*quantity*point value

For short positions: 

(Average Fill Price - Ask price)*quantity.

Here is an example of P&L calculation for the short position on futures: 

(4520.25-4520.50)*10*50= - 125 USD