Exit rules design: 4 exit types, and how to test them out-of-sample
Exit rules design is choosing the few rules that close a trade: stop loss, profit target, trailing exit, and time or session exit. An exit set is robust when each rule has a market reason, neighbouring settings behave alike, and the average trade after costs keeps its sign out-of-sample.
By Soren Huang · Published · updated · Editorial policy
Contents
- What is exit rules design, and what makes an exit set robust?
- What types of exit rules are there, and what does each one do?
- Trailing exit or fixed target: which should you use?
- Should exit rules be optimized?
- How do you test exits out-of-sample?
- How do you compare two exit sets fairly?
- Does position size change which exit set looks best?
- Frequently asked questions
- References
What is exit rules design, and what makes an exit set robust?
Exit rules design is choosing the few rules that close a trade: a stop loss, a profit target, a trailing exit and a time or session exit. An exit set is robust when each rule has a market reason, neighbouring settings give about the same result, and the average trade after costs keeps its sign on out-of-sample data.
An exit set is the small group of exit rules that one strategy uses together. Think of a trip: the entry decides when you leave the house, but every trip ends with a return, so the exit touches every single trade. That is why an exit can change a result faster than an entry can, and why it deserves its own design step rather than a setting copied from a template. A stop loss is usually the first exit a trader writes, and the choice between fixed ticks, a volatility distance, a time limit or a trailing rule is worked through in stop loss in a futures strategy: fixed ticks, ATR, time or trailing.
Three checks tell a robust exit from a lucky one:
- A market reason. The exit distance or time is tied to something the market shows: volatility, the session clock, or a price structure such as a swing low. A distance that is only "the number that tested best" has no reason.
- A flat neighbourhood. Settings about 10 percent either side of the chosen value give a similar result. If 2.2 ATR works and 2.0 and 2.4 do not, the exit describes noise.
- An out-of-sample hold. The average trade after costs keeps its sign after the split date, with the exit frozen.
What types of exit rules are there, and what does each one do?
There are four exit types, each with one job: a stop loss limits the loss, a profit target banks a move, a trailing exit follows a trend, and a time or session exit removes trades that stopped moving. A strategy needs at most one rule per job, and many good strategies use two or three jobs, not four.
A stop loss is an exit that closes the trade when the price moves against you by a set distance. A profit target is an exit that closes the trade when the price moves in your favour by a set distance. A trailing exit is an exit whose level follows the price as the trade gains, so it locks in part of a run while letting the run continue. A time or session exit is an exit that closes the trade after a set number of bars, or before the session ends, regardless of price. Each one protects against a different failure.
| Exit type | Job | Failure it protects against | Set it from |
|---|---|---|---|
| Stop loss | Limit the loss on one trade | One trade wiping out many winners | Volatility (ATR) or a price structure |
| Profit target | Bank a move of typical size | Giving back a gain that rarely grows further | The typical favourable move in your trade list |
| Trailing exit | Stay in a run, leave when it turns | Cutting the few long runs that make the year | Volatility, or a signal flip such as a moving average |
| Time or session exit | Remove trades that stopped moving | Dead trades tying up margin, or overnight gaps | The session clock or a bar count |
Two exits can do the same job, and that is where exit sets get bloated. A fixed target and a trailing exit both bank profit; a stop loss and a session exit can both end up closing the same losing trade. Pick one rule per job you actually need. A day-trading strategy, for example, usually leans on the session exit and a stop and skips the trailing exit, because trades are too short for a run to develop; the session rules that force intraday positions flat are explained for the cash market in Taiwan cash day trading: rules, costs and backtests.
Trailing exit or fixed target: which should you use?
A trailing exit fits a strategy whose profits come from a few long runs; a fixed target fits a strategy whose profits come from many moves of similar size. Your own trade list tells you which case you are in, through the distribution of maximum favorable excursion.
Maximum favorable excursion (MFE) is the largest open profit a trade reached before it closed. Picture a bus stop against following a friend. A fixed target is a bus stop: you decide in advance where you get off. A trailing exit is following a friend: you stay as long as they keep walking your way and leave when they turn back. If your friend usually stops after one block, waiting around is pointless; if they sometimes walk across town, the bus stop makes you miss the walk. How to read the MFE list and turn it into a target distance is covered in maximum favorable excursion: how to set profit targets from MFE.
| Question | Trailing exit | Fixed target |
|---|---|---|
| Shape of the MFE histogram | Long right tail: a few trades run far | Narrow peak: most trades reach a similar distance |
| Where the profit comes from | A handful of big winners | Many winners of similar size |
| Win rate | Lower, more small losses and give-backs | Higher, each winner capped |
| Market condition it needs | Trending stretches | Ranging or choppy stretches |
| Typical use | Trend following on daily or hourly bars | Mean reversion and short intraday trades |
Hypothetical example
Case one: 100 trades, 80 of them peak at about 12 points of open profit and 20 run to about 80 points. A fixed target at 10 points is hit by all 100 trades and collects 1,000 points. A trailing exit that gives back about 8 points from the peak collects about 4 points on each of the 80 short trades (320) and about 72 points on each of the 20 runs (1,440), about 1,760 points in total. The tail paid for the trailing exit.
Case two: 100 trades, 95 peak at about 12 points and only 5 reach 30. The fixed target at 10 points still collects 1,000 points. The same trailing exit collects about 380 points on the 95 short trades and about 110 on the 5 longer ones, about 490 in total. With no tail, the fixed target wins.
The histogram shape itself changes with market conditions. A strategy that showed a long tail during a trending year will show a narrow peak in a ranging year, which is why some traders switch between the two exits with a regime filter. Whether that switch adds anything is a testable question, and market regime detection: 3 regimes, how to measure and test them shows how to measure the regime before you condition an exit on it.
Should exit rules be optimized?
Exit rules should be set from a market quantity such as ATR and tested over a narrow range written down in advance, then judged by a flat plateau rather than by the best single value. An exit decides the result of every trade, so free optimization of an exit overfits faster than free optimization of an entry.
Average true range (ATR) is the average size of a bar's full price range over a chosen number of bars, and it is the most common market quantity to hang an exit on, because a stop that is one ATR wide in a quiet market and one ATR wide in a wild market is the same stop in volatility terms. The one formula worth writing is:
stop distance = k × ATR(n)
Here k is a multiplier such as 2 or 3, ATR(n) is the average true range over the last n bars, and the stop sits that many points away from the entry. The rule-of-thumb settings, and how the same ATR distance feeds into contract count, are in ATR trailing stop: the rule, the parameters and a futures backtest. The question for optimization is then not "which k is best" but "over what range of k does the result stay about the same".
A plateau is a range of neighbouring settings that all give a similar result; a spike is one setting that stands far above its neighbours. Picture a hill with a broad flat top against a flagpole: you can stand anywhere on the hilltop and be nearly as high, but step off the flagpole and you are on the ground. Pardo (2008) makes this the central test of an optimization: pick from the middle of a plateau, never the top of a spike. Bailey, Borwein, López de Prado and Zhu (2014) add the reason the spike exists at all: the more settings you try on one stretch of data, the higher the best one looks by chance alone.
- Write the range before you run. For a stop, something like 1.5 to 3.5 ATR in steps of 0.25. For a time exit, a handful of bar counts. Nothing outside the range is tried later.
- Run the whole range on in-sample data and plot result against setting.
- Keep the exit only if a plateau appears, and take a value from its middle, not its edge.
- Leave the trade count honest. A plateau built from 30 trades can still be noise; a plateau built from several hundred is evidence.
Writing the range first turns the search into a constraint rather than a hunt, and the search tool should hold that constraint for you. In AlphaPrime (Valynox) the allowed range for each exit parameter is entered with the entry and exit conditions in strategy generation, so the candidates that come out of the run never carry an exit value you did not agree to in advance.
How do you test exits out-of-sample?
Freeze the exit set at the end of the in-sample period, run it unchanged on later data, and compare two numbers across the split: the average trade after costs and the time in market. Time in market is the share of all bars during which the strategy held a position, and it is the number exits move most directly, because every exit decides how long a trade stays open.
The order of steps matters more than any single setting:
- Write the exit set and the allowed range for each parameter.
- Fit the parameters on in-sample data only, looking for plateaus as in the previous section.
- Freeze the settings. Write them down with the date.
- Run the strategy unchanged on the out-of-sample data.
- Compare the average trade after costs and the time in market before and after the split.
The step that is not on the list is the one that breaks the test: going back to step 1 because the out-of-sample curve looked soft. Once an exit is re-tuned on the later data, that data has become in-sample and the next out-of-sample result is already spent.
What do those two numbers look like on a real run? The box below is an AlphaPrime backtest on NQ daily bars from 2019-01-02 to 2025-06-30, long and short, one contract, with $20 commission and $10 slippage charged per trade. It tested a stand-in rule rather than a designed exit set: a Parabolic SAR flip served as the only entry and the only exit, with no stop, no target and no filters, so it stands for the simplest signal exit, not for the subject of this article. The run is the one candidate the search kept out of 1,024 it tried, chosen for its return against its drawdown; picking the kept candidate after the fact flatters the numbers, and nothing in the box is a forecast.
Source: AlphaPrime product engine (CPU), run 2026-10-31. NQ daily bars, 2019-01-02 to 2025-06-30, long and short, 1 contract, $20 commission and $10 slippage per trade.
| Number | Result |
|---|---|
| Net profit (closed trades) | $174,335 |
| Max drawdown | $128,220 |
| Trades | 53 |
| Win rate | 69.81% |
| Profit factor | 1.673 |
| Average trade | $3,289.34 |
| Time in market | 94.54% |
Read it as an exit designer, not as a scorecard. The time in market of 94.54% is what a signal-only exit produces: a flip rule closes one trade and opens the opposite one, so the strategy is almost never flat. Adding a time or session exit, or a stop, is the only way to bring that share down, and each addition trades some of the $3,289.34 average trade for less exposure. The 53 trades over six and a half years are also a reminder from the in-sample versus out-of-sample rule: a daily-bar exit set this slow needs more trades, or a walk-forward design, before a sign change across the split means much. The exit-side stops and reversal idea behind the rule goes back to Wilder (1978), who introduced both the Parabolic SAR and the true range that ATR exits are built on.
How do you compare two exit sets fairly?
Two exit sets compare fairly only when the entries, the costs, the test period and the contract count are identical, and the comparison is read on several per-trade numbers, not on net profit alone. Change one of those four and you are no longer comparing exits.
Net profit alone misleads because the two sets rarely take the same risk to earn it. A trailing set that stays in trades longer earns more per trade on a trending year while sitting through bigger losses; a target-and-stop set earns less per trade while being flat most of the time. Read both on a scoreboard:
- Average trade after costs: what one trade is worth once commission and slippage are paid.
- Time in market: how much of the period the money was exposed.
- Largest single loss: the worst one trade, which the stop and the session exit control.
- Share of trades closed by each rule: if a rule closes almost nothing, it is dead weight; if one rule closes almost everything, the others are decoration.
Hypothetical example
Same entries, same costs, same two-year period, one contract. Exit set A (stop, fixed target, session exit): average trade after costs $85, time in market 62 percent, largest single loss $1,200, trades closed 35 percent by stop, 50 percent by target, 15 percent by session exit. Exit set B (stop, trailing exit, session exit): average trade after costs $95, time in market 88 percent, largest single loss $2,900, trades closed 20 percent by stop, 60 percent by trailing exit, 20 percent by session exit. Set B earns a little more per trade, but it does so with the money exposed a third more of the time and a worst trade more than twice as large. Which set is better depends on which of those costs you can carry, and the scoreboard shows the trade clearly where net profit would not.
The share-of-closes row is the one most traders skip, and it is the cheapest diagnosis available. In the example, set A's session exit closes only 15 percent of trades; if that share fell to 2 percent on the out-of-sample data, the rule is doing nothing and can be removed. Kaminski and Lo (2014) show that whether a stop-loss rule adds or removes value depends on how the market's returns behave over time, which is the formal reason to run this comparison on your own market and your own entries instead of borrowing a verdict from another strategy.
Does position size change which exit set looks best?
Position sizing multiplies the same list of trades up or down, so it changes net profit and drawdown without touching a single exit, which is why exit sets are compared at one contract first and sizing is chosen afterwards. Position sizing is the rule that decides how many contracts each trade carries.
Think of the trade list as a song and sizing as the volume knob. Turning the knob up makes the loud parts louder and the quiet parts louder in the same proportion; it never changes the tune. If you compare two exit sets at different sizes, you are comparing volumes, not songs. Once the exit set is chosen at one contract, the contract count for a given account and stop distance follows from the free position size calculator.
The second box shows how far the knob alone moves the numbers. It takes the same 53 NQ trades from the run above, the same entries and the same Parabolic SAR exit, and re-sizes them under nine money-management methods with $100,000 of starting capital and a cap of 10 contracts, each method on its report defaults. Not one exit changed between rows; every difference comes from sizing.
Source: AlphaPrime product engine (CPU), run 2026-10-31. Same trades as the box above, capital $100,000, at most 10 contracts.
| Method | Net profit | Max drawdown | Average contracts |
|---|---|---|---|
| Fixed contracts | $525,125 | $384,540 | 3 |
| Fixed notional | $484,975 | $269,630 | 2.49 |
| Percent of equity | $1,026,820 | $1,281,660 | 5.77 |
| Fixed dollar risk | $603,940 | $217,965 | 2.53 |
| Fixed fractional risk | $1,153,025 | $1,281,660 | 6.45 |
| Volatility target | $603,940 | $217,965 | 2.53 |
| Fixed ratio | $365,375 | $629,420 | 3.06 |
| Equity curve trading | $485,310 | $244,940 | 2.28 |
| Kelly | $124,325 | $217,965 | 1.06 |
The spread is the lesson. At one contract the run above showed a max drawdown of $128,220; under percent-of-equity sizing the same trades show a max drawdown of $1,281,660, larger than that method's net profit of $1,026,820, while Kelly sizing averaged 1.06 contracts and showed a drawdown of $217,965. The exit rule did not get better or worse between those rows; only the multiplier moved. Had you compared two exit sets with one of them sized by percent of equity and the other at a fixed contract count, the sizing would have decided the contest before the exits had a say. These numbers also inherit the selection flattery of the first box: they are the kept candidate out of 1,024, re-sized, not a result anyone should expect.
The next step is a small one you can do with your own trade list: export the trades of your current strategy, sort them by maximum favorable excursion, and plot the histogram. Its shape tells you whether your profit lives in a tail or in a peak, and that single picture settles the trailing-versus-target question before any optimization starts.
Frequently asked questions
What types of exit rules are there?
Four types cover almost every strategy: a stop loss that limits the loss on one trade, a profit target that banks a move of typical size, a trailing exit that follows a run and leaves when it turns, and a time or session exit that closes trades that stopped moving or that would otherwise be held overnight. Each type does one job. A strategy needs at most one rule per job, and many use only two or three of the four.
Should I use a trailing stop or a fixed target?
Look at the distribution of maximum favorable excursion in your own trade list, the largest open profit each trade reached. If a few trades run far and most stop early, the profit lives in that tail and a trailing exit keeps it. If most trades reach about the same distance and few go further, a fixed target placed near that peak captures more. The shape can change between trending and ranging periods, so check it on more than one stretch of data.
Should exit rules be optimized?
Only over a narrow range written down before the run, and only to find a plateau, not a single best value. Set the exit from a market quantity such as ATR, test a handful of neighbouring multipliers, and keep the exit only if neighbouring settings give similar results. Because an exit decides the outcome of every trade, a freely optimized exit fits noise faster than a freely optimized entry.
Why does time in market matter when comparing exits?
Time in market is the share of bars during which the strategy held a position, and exits are what move it. Two exit sets with the same net profit can differ a lot in exposure: one may earn its result while flat most of the time, the other while almost always holding a position. Exposure is risk you carry whether or not the trade works, so it belongs on the scoreboard next to the average trade after costs.
Can I compare exit sets with different position sizes?
Not fairly. Sizing multiplies the same trade list, so a larger size inflates both net profit and drawdown without changing a single exit. Compare exit sets at one contract with identical entries, costs and period, choose the exit set from per-trade numbers, and then pick the sizing method as a separate decision.
References
- Wilder, J. W. (1978). New Concepts in Technical Trading Systems. Trend Research.
- Pardo, R. (2008). The Evaluation and Optimization of Trading Strategies (2nd ed.). John Wiley & Sons.
- Bailey, D. H., Borwein, J., López de Prado, M., & Zhu, Q. J. (2014). Pseudo-Mathematics and Financial Charlatanism: The Effects of Backtest Overfitting on Out-of-Sample Performance. Notices of the American Mathematical Society, 61(5), 458–471.
- Kaminski, K. M., & Lo, A. W. (2014). When Do Stop-Loss Rules Stop Losses? Journal of Financial Markets, 18, 234–254.

