Guide
How does the Template Trailing Strategy (Backtester) strategy work ?
The Template Trailing Strategy (TTS) acts as a sophisticated framework for back-testing trading strategies. It enables traders to insert their unique trading logic, handling entry, exit, and cancellation conditions, and to configure how their trades are executed, whether through limit, stop, or stop-limit orders. TTS also offers options for setting stop-loss and take-profit targets, with support for trailing stops and moving to breakeven, while including common methods for calculating trade quantities for effective risk management.
The strategy integrates tightly with Signal Indicators (SIs), which signal the optimal moments for entering and exiting trades. For example, a Signal Indicator based on a 200-day Simple Moving Average may send a "long entry signal" when the price closes above it, prompting the TTS to execute a corresponding trade based on predefined criteria, such as order type and execution timing.
To connect an SI to the TTS, add both the chosen Signal Indicator and the TTS to the same chart and configure the "Deal Conditions Mode" in the TTS settings to "External." Then, link the Signal Indicator’s output to the TTS using the strategy's "STRATEGY – EXTERNAL" group settings. This flexible system allows traders to test various trading setups by plugging in custom logic or choosing pre-built Signal Indicators.
For custom trading logic, traders can create a tailored Signal Indicator which offers full control over trading signals. Although it requires some coding in Pine Script, the process can be accelerated by leveraging open-source indicators as a foundation.