Configurable Strategy Template for Signals, Stops, and Trading Limits
Summary
This Pine strategy template supplies the execution and risk-management framework for a separately defined trading signal. It accepts an external indicator source, interpreting values as long or short entries and optionally as custom exits. Inputs govern trade direction, session and date filters, closing on opposing signals, and whether to enable percentage, trailing, or ATR-based stops and profit targets.
The template also provides optional controls for drawdown, intraday loss, daily and weekly trade counts, consecutive losing or winning trades, and consecutive losing days. It can close positions when session or strategy constraints are breached and can color chart bars by position state. The script emphasizes matching its strategy settings with the backtesting properties when comparing results. It is infrastructure rather than a complete trading strategy: it does not specify a signal-generation method or provide evidence of profitability. The configurable limits and exits require careful validation against the intended market, timeframe, and execution assumptions.
Key ideas
- The template maps external source values to long, short, and optional custom-close signals.
- Users can restrict direction, session, and date range, and choose how opposing signals affect positions.
- Optional stops and targets can use percentage distances or ATR-based levels.
- Risk controls can cap drawdown, intraday loss, trade frequency, and streak lengths.
- Backtest results depend on matching script settings with the strategy properties and on the supplied signal.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.