Buy stop order
You want to purchase a stock that is currently trading at $20.50 a share. Believing the price will continue to rise, you're willing to buy if it increases to $22.20 a share, and you place a buy stop order with a stop price of $22.20.
Once the stock hits $22.20 or higher, you buy the stock at the current market price, which may be significantly higher than your $22.20 stop price.
Sell stop order
You own a stock that's trading at $18.25 a share. You'll sell if its price falls to $15.10 or lower, so you place a sell stop order with a stop price of $15.10.
Once the stock drops to $15.10 or lower, your stock is sold at the current market price, which may vary significantly from the stop price.
Here's the risk: If the stock closed at $18 one day and opened at $12 the next day due to news on that stock, the $12 opening price would activate your stop price and trigger a market order. In this situation, your execution price would be significantly different from your stop price. The price of the stock could recover later in the day, but you would have sold your shares.