In most cases this is a function of the bid and ask. The bid is the highest price a market maker (who is buying your stock) is prepared to pay at a particular time for security; the ask is the lowest price acceptable to the market maker (who is selling you the stock) of the same security. The difference between the bid and ask is called the spread which is the market maker's profit.
While you may see your stock trade at your limit price, it may be at the ask if you are trying to sell or at the bid if you are trying to buy, therefore your order may not be executed. Even if the stock is trading within the spread, you are not guaranteed an execution.