Skip to content
All library documents

Calibrating Trade Targets and Stops with a Signal Backtester

Article ProRealCode

Summary

This article describes a backtesting indicator for evaluating exit distances on a supplied trading signal. It simulates a single-unit position, closes equal portions at up to three take-profit levels, and exits the remaining position at the first stop level reached or when an opposite signal appears. Levels can be specified using ATR, pips, or price points. The simulator checks stops before targets when both are touched within a bar, making that case conservative.

A dashboard reports trade statistics and target hit counts, while a selectable score ranks target distances using hit rate, expected profit, total profit, or risk/reward. The article recommends comparing settings on the instrument and timeframe of interest, checking filters, and including estimated spread and commission. Its examples use moving-average crosses or user-supplied signals. Results are only an initial screening aid: the described simulation uses fixed unit size and does not model slippage or position sizing, so its reported performance is not a substitute for a fuller execution-aware backtest.

Key ideas

  • The indicator evaluates exit settings for an input signal rather than generating entries itself.
  • Partial profit targets close equal portions, while the first reached stop closes the remaining position.
  • When a bar touches both a stop and target, the simulator records the stop first.
  • Target rankings can be based on hit rate, expected profit, total profit, or risk/reward.
  • Costs can be included, but the simulation still omits slippage and position sizing.

Tags

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