Backtest Lab Docs
Risk Management Price Modes
The three price-based risk management rules — Initial Stop Loss, Target Profit, and Dynamic (Trailing) Stop Loss — need a threshold price at which the trade should be exited.
Backtest Lab uses Price Modes to determine how that threshold price is calculated.
Two price modes are available for Initial Stop Loss and Target Profit:
- Distance from Entry
- Price Level
Dynamic (Trailing) Stop Loss currently supports Distance from Entry only.
Distance from Entry
In Distance from Entry mode, the threshold price is calculated using the trade's actual entry price and a distance defined by the selected rule.
This means the system automatically adjusts the threshold in the correct direction depending on whether the trade is a buy or a sell.
For example:
- For a buy trade, a stop-loss threshold is placed below entry, while a target-profit threshold is placed above entry.
- For a sell trade, a stop-loss threshold is placed above entry, while a target-profit threshold is placed below entry.
The user does not need to manually specify the correct side of the entry price. Backtest Lab handles the direction automatically.
Initial Stop Loss and Target Profit Options
For both Initial Stop Loss and Target Profit, the following Distance from Entry options are available:
- Fixed Points: The threshold is placed a fixed number of price points away from the actual entry price.
- Fixed Percentage: The threshold is placed at a fixed percentage distance from the actual entry price.
- ATR-Based: The threshold is based on the Average True Range (ATR), multiplied by a user-defined multiplier.
- Standard Deviation-Based: The threshold is based on a standard deviation value, multiplied by a user-defined multiplier.
For ATR-based and standard deviation-based rules, the multiplier determines how far the threshold is placed from the entry price.
Dynamic (Trailing) Stop Loss Options
For Dynamic (Trailing) Stop Loss, the currently available Distance from Entry options are:
- Fixed Points
- Fixed Percentage
These options define how far the trailing stop remains from the most favorable price movement achieved during the trade.
In the current beta, ATR-based, standard deviation-based, and Price Level trailing-stop modes are not available.
Price Level
In Price Level mode, the rule uses an explicitly determined price as the exit threshold.
Unlike Distance from Entry mode, the system does not automatically guarantee that this price lies on the correct side of the actual entry price.
This means the chosen price may sometimes be invalid for the intended rule because of market movement or changing indicator values.
For example:
- An Initial Stop Loss for a buy trade must be below the actual entry price.
- A Target Profit for a buy trade must be above the actual entry price.
- For a sell trade, the required directions are reversed.
If the computed price level is not on the correct side of the actual entry price, the rule is ignored and is not applied to the trade.
Initial Stop Loss and Target Profit Options
For both Initial Stop Loss and Target Profit, the following Price Level options are available:
- Saved Value: Use a previously saved value as the threshold price.
- Moving Average: Use a selected moving average value as the threshold price.
- Last N Candle: Use a price derived from the most recent N completed candles.
- Bollinger Band: Use a selected Bollinger Band level as the threshold price.
These options allow the exit threshold to depend on previously recorded values or market structure rather than only on a fixed distance from the entry price.
Choosing Between the Modes
The two price modes serve different purposes:
- Distance from Entry is useful when the exit should be defined relative to where the trade actually begins.
- Price Level is useful when the exit should refer to a specific market level, such as a saved level, an indicator level, or a recent price structure.
Because Distance from Entry uses the actual entry price directly, it automatically handles the direction of the rule. Price Level mode gives more flexibility, but the computed threshold must end up on the correct side of the actual entry price in order to be valid.