Not necessarily. This is, unfortunately, one of the problems with orders.

For example, if you buy a stock at $45 and put a stop limit in to sell at $40, will it be guaranteed to sell once the stock has reached this price?

If a stop order is established, it means that the stock will be sold at or beneath a certain price. If you own 500 shares of a company trading for $45 and you put a stop order in at $40, it could be executed at $40 on the dot. But if the market is falling fast, it may be executed at $38 or a range of lower prices as your shares are being sold off.

With a stop-limit order, you reduce the downward range by indicating you only want those shares to sell at $40. To make this work, another person in the market has to bid $40 for all 500 of your shares. However, if there isn't a bid, or a combination of several bids, for 500 shares at $40, then your order won't be executed. In widely traded stocks with high volume, this is usually not a problem.

Remember, shares don't necessarily go down incrementally like a thermometer. They can jump to certain prices if the bids and asks aren't matching up. It's possible for a stock to trade at $41 and then $38 without touching $40 mark in any real sense.

In practice, however, this doesn't happen very often and your stop limit order will likely be filled either in a single trade or over several trades as the stock price hovers around the $40 level. In short, a stop limit order doesn't guarantee you will sell, but it does guarantee you'll get the price you want if you can sell.

(See The Basics of Order Entry and Protect Yourself From Market Loss to learn more on this topic.)