Backtest Lab Docs
Trade Entry Risk Management
Risk management rules are safeguards that automatically monitor an open trade and close it when certain price or time-based limits are reached.
These rules help control potential losses, protect profits, and limit how long a position remains open.
In Backtest Lab, risk management rules are configured as part of the Trade Entry action. Once a trade is opened, the applicable rules are monitored automatically, without requiring separate states or exit conditions in the strategy.
Available Risk Management Rules
Backtest Lab currently supports four types of risk management rules.
Initial Stop Loss
An Initial Stop Loss sets a fixed price-based exit threshold when a trade is entered.
Its primary purpose is to limit potential losses by closing the trade if the market moves sufficiently against the position.
The stop-loss threshold remains fixed throughout the trade.
Target Profit
A Target Profit defines a price level at which an open trade should be closed to capture a desired profit.
For example, a trader might configure a target profit of 5% above the entry price of a long position.
Once the target is reached, the trade is automatically closed.
Dynamic (Trailing) Stop Loss
A Dynamic Stop Loss, also known as a Trailing Stop Loss, adjusts its exit threshold as the market moves favorably.
Unlike an Initial Stop Loss, which remains fixed, a trailing stop can move to reflect favorable price changes.
This allows it to serve two purposes: limiting potential losses and protecting gains that have accumulated during the trade.
Maximum Holding Period
A Maximum Holding Period limits how long a trade can remain open.
If the trade has not already been closed by another exit mechanism when the specified holding period is reached, it is automatically closed.
This provides time-based protection, allowing strategies to avoid holding positions beyond their intended duration.
Further Details
Each risk management rule has its own configuration options and execution behavior.
For detailed explanations of the available rules, see Risk Management Rule Types.
To understand how price-based risk thresholds are calculated and configured, see Risk Management Price Modes.