Exit conditions
A strategy can enter in one way and leave in several. This is the part of a strategy most people under-specify, and it is where most of the difference between a good and a bad result lives.
Every strategy must have an exit. Validation rejects one that can enter and never leave.
Exits combine with OR
Any one true causes an exit. That is the opposite of entry conditions, and deliberately so: an entry is a commitment and an exit is a release. The permissive combination is the safe one.
RSI(14) < 45 OR stop-loss hit OR take-profit hit OR session close
The six kinds of exit
1. Condition reversal
Your exit rule, stated the same way as an entry:
exit when RSI drops below 45
exit when EMA(9) crosses below EMA(21)
exit when close falls back below the 20-session high
Evaluated at candle close, like entries.
2. Stop-loss
Mandatory. A strategy with no stop does not pass validation, because per-trade loss would be unbounded.
| Type | Example |
|---|---|
| Percent from entry | 1.2% stop |
| ATR-based | stop at 2× ATR(14) below entry |
| Price level | stop at 2,769.50 |
| Structure-based | stop below the swing low |
It is the price at which the strategy tries to exit. If the market gaps through it, or a single candle passes through it, you exit at the price available.
On Indian equity this happens at every overnight gap. On crypto it happens on any liquidation cascade. See Risk disclosure.
3. Take-profit
| Type | Behaviour |
|---|---|
| Fixed percent | Exit at a set gain from entry |
| Risk-multiple (R) | Exit at a multiple of the entry-to-stop distance |
| Laddered (multi-TP) | Exit fractions of the position at successive targets |
| Trailing | A ratcheting give-back line on the profit side |
percent means a price or premium gain: "once it gains 25%", "book at +50%", "at 10% profit".
risk_reward means a multiple of risk: "at 2R", "3× risk", "1:2".
A percentage is never a risk-multiple. Converting one to the other needs the stop in the same unit. Get it wrong and a ladder stated in percent gains is displayed and executed as R-multiples, a 25% option-premium target read as "25:1 RR", when on a 0.25% stop the true figure is 100R.
The builder requires the denomination explicitly for exactly this reason. Say "percent" or "R" and it matches your words.
4. Trailing take-profit
A ratcheting line on the profit side. Two parameters:
| Parameter | Meaning |
|---|---|
| Activation | The gain at which the trail arms, stated in percent or in R |
| Distance | How far behind the running peak the line trails |
Once armed at the activation threshold, the line follows the peak (for a long) or the trough (for a short) and fires on the pull-back, booking the exit as a trailing take-profit.
trailing take-profit: arms at 1.5%, trails 0.8%
Mutually exclusive with a trailing stop: the loader enforces it. One protects, one follows, and having both would give two ratchets fighting over the same level.
5. Break-even and profit lock
| Control | Behaviour |
|---|---|
| Break-even | Once the trade is a stated distance in profit, the stop moves to entry |
| Break-even at R | The same, with the trigger stated in R rather than percent |
| Lock profit | A jump-and-lock floor: at a stated gain, the stop jumps to a stated locked profit |
Both convert an open winner into a trade that cannot become a loser. Both also increase the chance of being stopped out on noise before the move completes, a real trade-off, not a free improvement.
Multi-TP rungs can carry a risk action that fires when the rung hits:
| Risk action | Effect |
|---|---|
move_sl_to_breakeven | Stop to entry |
move_sl_to_previous_tp | Stop to the previous rung's level |
none | Leave the stop where it is |
6. Time and session exits
| Exit | Behaviour |
|---|---|
| Session square-off | Intraday strategies force-exit at session end |
| Time exit | A wall-clock cutoff: force-exit past it, and block new entries |
| Bar count | Exit after N bars in the position |
| Expiry | For derivatives, an expiry-flag condition |
| Friday / holiday exit | Calendar-driven exits from session flags |
A crypto strategy has no forced exit at a session boundary, because the venue never closes. If you want a time-bounded position on a continuous venue, state a time exit or a bar count, the session will not do it for you.
Multi-target ladders
Close part of a position at a first target and let the rest run.
exit 40% at 1R, 30% at 2R, and let the rest trail
exit half at +25%, the remainder at +50%
Rules:
| Rule | Why |
|---|---|
| Fractions cannot exceed the position | Validation rejects a ladder that sells more than 100% |
| Rung prices resolve at entry time | From entry price and the initial stop, so R-multiple rungs work with any stop type |
| Mutually exclusive with trailing take-profit | Two profit-side mechanisms would conflict |
A fixed take_profit_pct must be zero when a ladder is set | The loader enforces it |
When several exits fire at once
The exit engine resolves simultaneous candidates by a priority rule, and the default is the conservative one:
| Priority rule | Resolution |
|---|---|
| Most conservative (default) | The tightest level, for a long, the highest stop |
| Highest stop | The highest level regardless of side |
| Lowest stop | The lowest level |
| Priority order | An explicit ordering you specify |
"Most conservative" means that when a trailing stop and a break-even stop both fire, the one that protects more capital wins. That is the right default and it is worth knowing it is the default rather than an accident.
The simulator cannot know the intra-candle path, so it assumes the stop filled first, deliberately pessimistic. See Backtest limitations
Reference points
Exits can be anchored to more than the entry price: average entry price for a scaled position, anchored VWAP, ATR-scaled distances, Bollinger or Keltner-based trails, bar extremes, and, for derivatives, the option premium, the underlying, the mark price or the index price.
For a derivatives position the distinction between premium and underlying matters enormously: a percentage stop on a premium is a much larger move than the same percentage on the underlying. See Derivatives risk disclosure
What to specify, in order of consequence
- A stop-loss. Mandatory. Sets your maximum per-trade loss (subject to gaps).
- An exit condition. What ends a trade that neither stops out nor hits target.
- A take-profit, or an honest decision not to have one. A strategy with no profit target relies entirely on the exit condition and the trail.
- A time or session bound, if the position should not be held indefinitely.
- Break-even or profit lock, if you would rather protect than maximise.
A checklist
- There is a stop-loss
- There is an exit condition beyond the stop and target
- Percent and R targets are stated in the unit I actually meant
- A ladder's fractions do not exceed the position
- I have not set both a trailing stop and a trailing take-profit
- A continuous-venue strategy has a time bound if it needs one
- For a derivative, the stop is anchored to the series I meant