Question on adding to existing position?

HI,
i am a new investor in the markets so i had the following query:
say, i have the already open position in the market of reliance shares bought at rs 1000 and the quantity is 100, now i want to add to this existing position by buying another 50 quantity at price 1100 and the current market price is say 1150, so i go ahead and buy them, now i want to sell these shares and the quantity for selling is say 70, then which shares will get executed first for selling at price 1150, i mean the first bought first sold basis or what else can be the option. please help.

I guess, you are trying to figure out the P&L, here is how it works -

Your first buy is 100 @ 1000
Your 2nd buy is 50 @ 1100
Avg buy price for 150 shares is 1033.33

So when you sell @ 1150, your P&L will be 1150 - 1033.33 = 116.6