What you mentioned above is only applicable to non-T2T stocks., it is as follows- If holdings are sold, it is displayed on position and again if the same stock is bought before the day's close then PnL will be calculated for selling at the higher price, and then buying at a lower price on the same day. The original holdings & avg remain unaffected.
Wherein for this scrip (T2T), if you again buy it will be a completely separate transaction and the latest buy value will be the avg. BTST is only possible for the new buy.
Hope that clears..
@Anupam singh