A stop-loss order is a risk management tool that automatically exits a position when the price moves against the trader by a specified amount. For a long position, a stop-loss is placed below the current price. If the price falls to the stop level, the order triggers and becomes a market order, closing the position to prevent further losses. Stop-loss orders enforce trading discipline by removing the emotional temptation to hold losing positions.
How stop-loss orders work
A stop-loss order has two phases. First, it sits dormant as a conditional order, monitoring the market price. Second, when the market price reaches the stop price, the order triggers and becomes a market order (or in some cases, a limit order, known as a stop-limit). Once triggered, the order executes at the best available price, which may differ from the stop price due to slippage.
For example, a trader buys a stock at $100 and places a stop-loss at $95. If the stock drops to $95, the stop triggers and a market sell order is submitted. The actual fill might be at $94.95 or $94.80 depending on market conditions and liquidity at the time of execution. In fast-moving markets, the slippage between the stop price and the fill price can be substantial.
Types of stop-loss orders
Fixed stop-losses are set at a specific price or percentage distance from the entry. A 2% stop on a $100 entry is placed at $98. This approach is simple but does not adapt to the instrument's volatility.
Volatility-based stops adjust the distance based on the instrument's recent price range. Using the Average True Range (ATR) as a guide, a stop might be placed 2 ATR units below the entry. This means the stop is wider for volatile instruments and tighter for calm ones, reducing the chance of being stopped out by normal price noise.
Trailing stops move with the price in the trader's favor but never move against the trade. If a stock bought at $100 rises to $110, a 5% trailing stop moves from $95 to $104.50. If the price subsequently drops to $104.50, the stop triggers, locking in a $4.50 profit rather than allowing the trade to turn into a loss.
Stop-loss considerations in backtesting
Accurate stop-loss modeling requires intrabar price data. With daily bars, it is unclear whether the high or low was reached first during the day. A bar that shows a high of $105 and a low of $94 might have hit the stop at $95 before rallying to $105, or it might have rallied first and then dropped. Without intrabar data, the backtest must make assumptions that affect accuracy.
Tick-level data resolves this ambiguity by providing the exact sequence of prices during the bar. This ensures stop-loss orders trigger at the right time and fill at realistic prices.
Practical example
A swing trader enters a long position at $50.00 and places a volatility-based stop-loss at 1.5 times the 14-day ATR below the entry price. The ATR is $1.20, so the stop is placed at $48.20. Over the next week, the stock drops gradually to $48.20, triggering the stop. The fill price is $48.15 due to a slightly wider spread in the afternoon session. The total loss is $1.85 per share (3.7%), within the trader's risk budget.
How Tektii helps
Tektii's backtesting engine processes stop-loss orders against tick-level data, ensuring they trigger at the correct time and fill at realistic prices. The platform resolves the intrabar ambiguity problem that plagues bar-based backtesting engines, where it is unclear whether a stop was hit before or after a profit target during the same bar. This accuracy is critical for strategies where stop-loss placement directly determines profitability.