Is it for your stock delivery trades or F&O Positions?
The calculation of the buy average price follows the First In, First Out (FIFO) method for both delivery and even F&O trades as mandated by the Income Tax Act.
Can you please share your client ID with me in DM? Will get this checked and get back to you.