Avg price after a CNC squareoff?

Assume the following:

  1. Bought Share X 100 QTY @ 318 CNC Delivery

  2. Sold Tommorow Share X 100 QTY @ 321 CNC Delivery
    However at the end of the day the share price fall steeply to 305 and we Squareoff our CNC order with 100 QTY BUY Share X @ 305

Now in our holding which will be the average price 318 or 305?

This will be considered as an intraday trade where you make a profit of 100 * 16.

And the holdings in your account will remain at 318.