How average price is calculated if i sell in T2T

Hi Friends,

How average traded price is calculated if i sell some of my holdings.

For example
Stock A - BUY - 2Q - 100 = ATP is 100
Stock A - BUY - 2Q - 98 = ATP is 99
Stock A - SELL - 2Q - 70 = ATP is ?

What would be my ATP? What would be the formula?

Didn’t get this example. In the first trade, you are buying 2 quantities at 100 each so the average is 100. In the second trade you are buying 2 quantities at 98 each, how is the average 99 here? Should be 98 right?

By the way, you can go through this support article to understand how buy average is calculated.