Skip to main content

Exit conditions

Who it’s for
Anyone stating when a strategy should close a position
Assumes
You have read Entry 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.

TypeExample
Percent from entry1.2% stop
ATR-basedstop at 2× ATR(14) below entry
Price levelstop at 2,769.50
Structure-basedstop below the swing low
A stop-loss is not a floor on your loss

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

TypeBehaviour
Fixed percentExit 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
TrailingA ratcheting give-back line on the profit side
State percent and R correctly. They are not interchangeable

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:

ParameterMeaning
ActivationThe gain at which the trail arms, stated in percent or in R
DistanceHow 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

ControlBehaviour
Break-evenOnce the trade is a stated distance in profit, the stop moves to entry
Break-even at RThe same, with the trigger stated in R rather than percent
Lock profitA 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 actionEffect
move_sl_to_breakevenStop to entry
move_sl_to_previous_tpStop to the previous rung's level
noneLeave the stop where it is

6. Time and session exits

ExitBehaviour
Session square-offIntraday strategies force-exit at session end
Time exitA wall-clock cutoff: force-exit past it, and block new entries
Bar countExit after N bars in the position
ExpiryFor derivatives, an expiry-flag condition
Friday / holiday exitCalendar-driven exits from session flags
Continuous venues have no session square-off

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:

RuleWhy
Fractions cannot exceed the positionValidation rejects a ladder that sells more than 100%
Rung prices resolve at entry timeFrom entry price and the initial stop, so R-multiple rungs work with any stop type
Mutually exclusive with trailing take-profitTwo profit-side mechanisms would conflict
A fixed take_profit_pct must be zero when a ladder is setThe 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 ruleResolution
Most conservative (default)The tightest level, for a long, the highest stop
Highest stopThe highest level regardless of side
Lowest stopThe lowest level
Priority orderAn 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.

In the backtest, a stop and a target inside one candle resolve to the stop

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

  1. A stop-loss. Mandatory. Sets your maximum per-trade loss (subject to gaps).
  2. An exit condition. What ends a trade that neither stops out nor hits target.
  3. 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.
  4. A time or session bound, if the position should not be held indefinitely.
  5. 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

Next