To avoid buying or selling a stock at a price higher or lower than you wanted, you need to place a limit order rather than a market order. A market order just executes the moment an order is placed. A limit order is an order to buy or sell a security at a specific price. You could use a limit order when you want to set the price of the stock. In other words, you want to sell/buy particular scrip at a price other than the current market price. However, although a limit order guarantees a price, it cannot guarantee the execution of the trade. This is because the stock might not reach the desired price on that particular trading day owing to market-related factors. Hence it is totally possible that you order remains in the system the whole day and does not execute and hence has to be automatically cancelled at the end of the trading day.