Skip to content
All library documents

Configurable Stop-Loss and Reward Targets for Strategy Backtesting

Article Strategy library · Author: TZack88

Summary

This Pine Script excerpt describes a configurable framework for evaluating trade exits and risk settings. It offers a choice between a risk-to-reward target and fixed percentage take-profit and stop-loss levels. In risk-to-reward mode, the target ratio is configurable, while stop placement can be based on an ATR multiple, a pivot low, or a value derived from a smoothed average and a multiplier. Inputs also provide for moving a stop toward breakeven after a specified reward threshold and setting an offset above entry.

The visible source identifies a 1.5 default reward ratio, ATR stop factor of 1.4, pivot lookback of 8, and fixed target and stop values of 1.5 percent each; it also specifies initial capital, equity-based sizing, and commission. However, the supplied document cuts off partway through the code, before the full order and exit logic is shown. It therefore supports describing the available controls, but not how they interact in all cases or whether any approach performs well. The script is a backtesting tool, not a complete entry strategy in the provided excerpt.

Key ideas

  • The framework can compare risk-to-reward exits with fixed percentage targets and stops.
  • Stop placement options include an ATR-based level, a pivot low, or a smoothed-average-derived value.
  • Breakeven controls allow a reward threshold and an offset above the entry price.
  • The excerpt specifies default settings but ends before the complete trade management logic appears.
  • The document provides no reported backtest results or entry signal strategy.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.