Backtest Lab Docs

Trades to Close

A Trade Exit action allows a strategy to close existing open trades when it enters a particular state.

Rather than identifying a specific trade to close, Backtest Lab lets you define rules that determine which open trades should be selected for exit.

The Trades to close setting filters trades based on their direction.

Available Options

All Trades

Targets all open trades, regardless of whether they are buy (long) or sell (short) positions.

Only Buy Trades

Targets only open buy (long) trades. Any open sell (short) trades are left unaffected.

Only Sell Trades

Targets only open sell (short) trades. Any open buy (long) trades are left unaffected.

Combining Trade Exit Filters

The Trades to close setting works together with the Entered by setting, which filters trades according to the state that originally opened them.

A trade must satisfy both filters to be selected for exit.

For example, you could configure a Trade Exit action to close only buy trades that originated from a particular state, leaving all other open trades unaffected.

Learn more about Entered By.