I am beginner in intraday of NSE equity shares in zerodha. I failed to calculate average some time when i play multiple times on same share in a day.

**during morning hours:**
For example if i bought 1000 number of HDFC shares at 500/- and it gave a spike of 515/- in a 5 minutes, i sold. so my profit would be (1000*5=5000).

**during afternoon hours:**
If again i brought same 2000 number of HDFC shares at 490/- and its gave spike of 494/- in 10 minutes , i sold. i expected my profit should be (2000*4=8000).

so total profit of the day is 4K+ 8K= 12K. but some of my calculation is wrong. i am not seeing 12K, some thing less than that. what is exact calculation? 

**If possible explain for below scenarios as well.**
Morning: Sale-buy(short)
Afternoon: Buy-sale
-----------------
Morning:Buy-sale
Afternoon: sale-buy
-----------------
Morning: Sale-Buy(short)
Afternoon: sale-buy(short)