# Execution rules: trade management

> E13 Breakeven, E14 Trailing stops, E15 Partial closes, E16 Time and condition exits, E17 Pending order expiry

Source: https://algobarsx.com/docs/rules-trade-management/

###  E13 **Breakeven**

When the price path reaches the `at` level, the stop moves to the entry price plus `offset` for a long trade (minus for a short trade) if that tightens it. The new stop applies to the rest of the path.

###  E14 **Trailing stops**

Once the price path reaches the `after` level, the stop follows the most favourable price reached since then, less `by` for a long trade (plus for a short trade), and only ever tightens. It updates at every point of the path. Distances that come from indicators use their value at the last closed bar.

###  E15 **Partial closes**

`partial P at: X` closes P of the trade's original size when the price path reaches X (at X, or at the open when the bar gaps past it), rounded down to the lot step. A partial that rounds to zero is skipped. If the size left would fall below the minimum lot, the whole trade closes. Each partial fires once.

###  E16 **Time and condition exits**

`exit after: N bars` closes a trade at the open of the bar after the Nth bar close following its entry bar. `exit after:` with a duration closes it at the open after the first bar close at or beyond that time since the fill. `exit when:` closes it at the open after the bar close where the condition is true.

###  E17 **Pending order expiry**

`expires: N bars` keeps an order active for the N bars after the bar that created it; `expires:` with a duration keeps it active until the first bar close at or beyond that time. An order that has not filled by then is cancelled at that close. Pending orders still open when a test ends are cancelled.
