Skip to content
All library documents

External-Signal Backtesting with Risk-Reward or Fixed Exits

Article TradingView scripts

Summary

This script is a framework for backtesting an external indicator's long signals with configurable exits. The connected indicator exposes a plotted signal value; when that value matches a chosen threshold and the strategy is flat, the script opens a long trade. Users can select a fixed percentage stop and target, or set a target from a chosen risk-to-reward multiple applied to a selected stop method. The available stop calculations are based on average true range, recent pivot lows, or a VWAP-related calculation. An optional breakeven feature moves the stop above the average entry after a configured target condition, and a date range can limit the test.

The document explains the interface and includes code, but presents no backtest statistics or comparative evidence. The implementation shown only opens long positions, so it does not test short signals. Its exit behavior and signal matching depend on the script's calculation details and settings; users should inspect the code and validate how the external signal is represented. Backtest results also depend on costs, slippage, data, and execution assumptions, and do not establish future performance.

Key ideas

  • An external indicator can supply entries through a plotted signal value matched to a threshold.
  • The framework offers either a fixed percentage stop and target or a risk-multiple target based on a selected stop calculation.
  • Stop choices include an ATR-based level, a recent pivot low, and a VWAP-related calculation.
  • An optional rule raises the stop above entry after a configured target condition.
  • The shown implementation tests long entries and provides no performance results.

Tags

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