How is buy average calculated?

For example, India Cements - last buy avg. I saw was 126.8 and then I just sold 25 shares @ 123 and 20 shares @ 121. I did not buy a single share but still my buy avg. today has come down to Rs. 120.6. How is it possible that my buy avg. of all other shares come down when I just sell shares by booking loss?

Here's my trade book.

Trade date

Symbol

Type

Qty

Rate

02-11-2016

INDIACEM

B

30.00

158.50

03-11-2016

INDIACEM

B

20.00

156.75

04-11-2016

INDIACEM

B

25.00

148.70

04-11-2016

INDIACEM

B

5.00

148.70

09-11-2016

INDIACEM

B

10.00

135.00

09-11-2016

INDIACEM

B

15.00

135.20

11-11-2016

INDIACEM

B

25.00

132.00

15-11-2016

INDIACEM

B

15.00

123.00

16-11-2016

INDIACEM

B

10.00

115.65

02-12-2016

INDIACEM

B

25.00

115.00

15-12-2016

INDIACEM

B

20.00

113.00

26-12-2016

INDIACEM

B

50.00

109.00

30-12-2016

INDIACEM

S

25.00

116.00

02-01-2017

INDIACEM

S

20.00

121.00

02-01-2017

INDIACEM

S

25.00

123.00

Here is the trade book you've attached, just so anyone reading this need not scroll to the question for all my references.

Trade date

Symbol

Type

Qty

Rate

02-11-2016

INDIACEM

B

30.00

158.50

03-11-2016

INDIACEM

B

20.00

156.75

04-11-2016

INDIACEM

B

25.00

148.70

04-11-2016

INDIACEM

B

5.00

148.70

09-11-2016

INDIACEM

B

10.00

135.00

09-11-2016

INDIACEM

B

15.00

135.20

11-11-2016

INDIACEM

B

25.00

132.00

15-11-2016

INDIACEM

B

15.00

123.00

16-11-2016

INDIACEM

B

10.00

115.65

02-12-2016

INDIACEM

B

25.00

115.00

15-12-2016

INDIACEM

B

20.00

113.00

26-12-2016

INDIACEM

B

50.00

109.00

30-12-2016

INDIACEM

S

25.00

116.00

02-01-2017

INDIACEM

S

20.00

121.00

02-01-2017

INDIACEM

S

25.00

123.00

Buy average is calculated based on FIFO or first in first out. What this means is, until 26th Dec, you had 250 shares with average price of 126.8. 

On the 30th, you sell 25 shares. When this is sold, the first 25 shares will not be considered for calculating the buy average price of remaining 225 shares(250 -25). Because the average is now calculated at  225 shares, the average price is going to change. 

Similarly, when the you the next 20 shares +25 shares, the next 45 shares bought first will not be considered for calculating the average price of remaining 180 shares (225-45). 

So there is nothing wrong with it, this is how buy average price is calculated.