When you place your buy order you can not know the entry price you will get so we have to assume it is the same as the close price. Once we are ‘onmarket’ we can adjust the exit price based on our actual entry price as we now know it.
We use pending limit orders to exit at the better price.