How to Stress Test a Trading Strategy
Once you have a working strategy, you can apply a stress test. A stress test runs a number of different tests to see how a strategy might perform under different market conditions and scenarios. A stress test produces a range of performance outcomes and the medians.
From the tester page, set the Stress test switch in the panel to on. Then click the Run button from the bottom menu.
The stress test may take a few moments to run, depending on the strategy and the time frame selected. After it’s complete the results should look something like the screen below.
The main chart shows the range of profit and losses that the strategy made during the stress test. The lower line shows the worst performance, the upper line the best performance, and the middle line is the median.
The lower chart shows the distribution of returns. Each block represents a single run. The black bar represents the median return of the strategy.
The panel on the right shows the performance data.
- Start balance: Balance at start of test
- End balance: Balance at end of test
- Profit: Total profit returned
Margin and Leverage
- Min equity: Minimum necessary starting equity
- Chance of margin call: Chance of margin call at minimum equity
- Current start balance: Start balance set in tester
- Chance of margin call: Chance of margin call with start balance
- Contract size: Set contract size for tester
- Maximum leverage: Maximum leverage for tester
Performance and Risk Measures
- Sharpe ratio: The Sharpe ratio over selected period
- Sortino ratio: The Sortino ratio over selected period
- Beta: Beta of strategy versus the underlying
- Negative vol ratio: Ratio of negative volatility to volatility
- Profit high: Profit high watermark
- Profit low: Profit low watermark
The chart below shows the margin call probabilities for different starting balances. The two plots show the outcome at current volatility and twice current volatility. A higher start balance results in a lower chance of exceeding margin limits.
You can view the results for the best case, worst case and current by clicking the buttons on the summary panel.
The metrics table below shows the range of different outcomes during the stress test. In this example, the lowest total profit was $162 and the best was $1433. The median was $823. Looking at the median can be insightful because sometimes the worst or the best case are outliers. The median will give a better idea of the spread of most probable returns.
You can modify any of the input settings for the stress test in the same way as a regular back test.