How to calculate P&L on futures trading

chinze

New member
Joined
Dec 5, 2019
Messages
3
Hello.
I would like some help in how to calculate the P&L for futures trading.
This specific futures contract quotes in 0.25 steps and each 0.25 steps is worth $5. Between 8291 and 8292 there's 4 steps which equals $20.

I have the lists of trades I did:

Timesell/buyQtyPrice
6:05:15​
Sell
1​
8291.75​
6:06:00​
Sell
1​
8292.5​
6:08:58​
Sell
1​
8290.75​
6:10:16​
Sell
1​
8293​
6:10:51​
Sell
1​
8293.75​
6:11:41​
Buy
1​
8292.75​
6:12:02​
Buy
1​
8293.5​
6:12:28​
Sell
1​
8293.5​
6:12:57​
Buy
1​
8294​
6:13:08​
Sell
1​
8294.5​
6:13:56​
Sell
1​
8294.25​
6:14:15​
Buy
1​
8295.5​
6:14:23​
Buy
1​
8295.25​
6:14:25​
Buy
1​
8295​
6:14:30​
Buy
1​
8294.75​
6:14:33​
Buy
1​
8295​

I started my position by selling 5 contracts, then bought back 2 contracts, sold 1, bought 1, sold 2 and bought 5, closing this way my position.
The P&L for this trade should be based on the average weighted price.
My average weighted price after buying the first 5 contracts is 8292.35:

(8291.75+8292.50+8290.75+8293+8293.75) / (1+1+1+1+1) = 8292.35

I then buy my first contract at 8292.75. To get my PnL for that first contract I bought, I would do:

8292.75 - 8292.35 (average weighted price) = 0.40 (since we move is 0.25 steps, we need to round this to 0.50 which corresponds to $10)

I then buy another contract at 8293.50, and from here forward my head starts to drift, without really knowing how to continue to do the calculations in a proper way.
When I bought that first contract, my average weighted price changed. Instead of 5 contracts sold, I now only have 4.
How to I calculate the new average weighted price?
When I bought the second contract, the P&L calculation will be based on that new average weighted price correct?

But then, I sell another contract. Again, I'm completely lost here.
How to I calculate the new average weighted price? I'm now again sold 4 contracts.
And afterwards, I buy another one...

I lost tract of the time I've lost watching youtube videos, reading websites, where they discuss the average weighted price but found nothing that could help me with this.

I appreciate if anyone of you experts could give me a hand here.
Thank you so much.
 
There is nothing to weight because every transaction was for ONE contract. Add up the amounts you received on each sale. Add up the amounts you paid on each purchase. Subtract them and find your profit.

Who told you to use weighted averages? They merely are a different way to do what I suggested above. Moreover, they do not seem to be easier to do than the obvious method shown above.
 
Hi Jeff, thank you for your reply.

The guys I'm working with told me to correctly calculate this I would need to find the average price. It needs to be a formula that can be used for all situations.
The example I made above is a simple one. It can be something like this also:

Sell Qty
10​
Price
1594.7​
Sell Qty
8​
Price
1594.9​
Sell Qty
11​
Price
1594.6​
Sell Qty
10​
Price
1594.7​
Sell Qty
9​
Price
1594.8​
Sell Qty
9​
Price
1594.8​
Sell Qty
6​
Price
1594.6​
Buy Qty
50​
Price
1594.6​
Buy Qty
5​
Price
1594.6​
Buy Qty
8​
Price
1594.7​


Sell a total of 63 contracts with an average weighted price of 1594.727.
I then buy 50 contacts at 1594.6. This will give a profit of 0.127 (1594.727 - 1594.6)
I still have 13 contracts to buy back and close the position.
My question is, what is the average weighted price for those remain 13 contracts? How do i calculate those?

I then buy 5 more contracts also at 1594.6.
Only 8 contracts remain now. Again, what will be the average weighted price for those 8 contracts?

Thanks you
 
Ahh, I see.

First, you need to understand how to calculate a weighted average.

Let's start with notation.

[MATH]\sum_{k=1}^n x_k = x_1 \text { if } n = 1; \text { but } \sum_{k=1}^n = x_n + \sum_{x=1}^{n-1} \text { if } n > 1.[/MATH]
If you are not used to doing math, that definition may be a bit abstract, so let's do an example.

[MATH]x_1 = 13, x_2 = 7, \text { and } x_3 = 17 \implies[/MATH]
[MATH]\sum_{k=1}^1 x_k = 13,\ \sum{k=1}^2 = 7 + \sum_{k=1}^1 = 7 + 13 = 20, \text { and } \sum_{k=1}^3 = 17 + \sum_{k=1}^2 = 17 + 20 = 37.[/MATH]
In short, [MATH]\Sigma[/MATH] means add them up. The Sigma was the Greek letter equivalent to the English S and stands for SUM.

A weighted average is

[MATH]\text {If } w_k = \text {the kth weight, and } v_k = \text {the kth value, then}[/MATH]
[MATH]A_{weighted} = \text {the weighted average} = \left ( \sum_{k=1}^n w_k * v_k \right) \div \sum_{k=1}^n w_k.[/MATH]
The average that you learned in fourth grade is a weighted average where all the weights are equal.

Is this part completely clear?

So I think your problem reduces to understanding what the weights are. They are the number of contracts bought or sold at the same price. So the weighted average price of contracts purchased is

[MATH]A_{\text {purchase price}} = \left ( \sum_{k=1}^n p_k * q_k \right ) \div \sum_{k=1}^n q_k, \text {where }[/MATH]
[MATH]p_k = \text {the purchase price of the kth purchase, } q_k = \text {the number of contracts in the kth purchase, and }[/MATH]
[MATH]n = \text {the number of purchases.}.[/MATH]
You follow a similar procedure to calculate the weighted average price of contracts sold. Assuming n contracts purchased and m sold, your breakeven weighted purchase price is

[MATH]\dfrac{(A_{\text {sales price}} * m) - (A_{\text {purchase price}} * n)}{m - n}.[/MATH]
 
Last edited:
Hi Jeff. Again, thank you for your help.

Let me say this, the only brain cell I had left, after spending so many hours understanding how to do this, just died when it read your reply o_O

I will need some time to sink this in.

Again, thank you
 
Hi Jeff. Again, thank you for your help.

Let me say this, the only brain cell I had left, after spending so many hours understanding how to do this, just died when it read your reply o_O

I will need some time to sink this in.

Again, thank you
Take it line by line, and ask questions at every place you hit a roadblock.
 
Top