How is the average price of my holdings calculated?

The average price of your holdings is a weighted average of all your buy transactions for a stock. When you sell some shares, the first purchased shares are sold first (following the First In, First Out or FIFO method).

Average price =  (Value of shares after selling shares using FIFO + Value of new shares bought)/ (Shares after removing sold shares using FIFO + Shares bought today)

For example, you bought ABC at two different times:
Set 1: 100 shares of ABC at ₹50 per share. 
Set 2:   50 shares of ABC at ₹60 per share. 

If you want to sell 50 shares of ABC, the oldest 50 shares from Set 1 will be sold first.

Average price = ((100 – 50)*₹50 + 50 * ₹60)/(50 + 50) = ₹55 per share.