If you sell shares out of your demat account, there is no additional margin charged on the sell leg, since the shares are meant for delivery, and they are eventually delivered in the form of Early Pay-in.
Instead, as per guidelines issued by SEBI in December 2020, if you sell shares from your demat account, 80% of the sale proceeds gets available on the same day that you can use to enter into another trade or take another position. If you buy back the same shares on the same day, it becomes an intraday trade, and the delivery gets withheld, resulting in forfeiture of margins against 80% of the sell value, as previously mentioned.
There is no margin shortfall if -
80% of the value of shares sold is bought back
80% of the sell value is used as margins to take any other position
In case you intend to do both, or if you wish to buy back the same shares beyond 80% of the value of shares sold, you will need to bring in additional margin in the form of cash / pledging of stocks, otherwise this will lead to margin shortfall.
The profits from intraday equity transactions cannot be used on the day of trade since equity transactions are settled on T+1 day, i.e. trade day + 1 trading day.
Similarly, profits arising from trading intraday in derivatives cannot be used on the trading day. They can be used from the next trading day since derivatives settlement takes place on T+1 day.