Calculating Monthly and Annual Strategy Returns in ProBacktest
Summary
The document describes a ProBacktest indicator that tracks strategy profitability by calendar month and year. It initializes capital values, detects date changes, calculates each completed period’s profit from strategy profit and starting capital, and graphs the resulting percentage returns alongside a zero line. The intended use is to add the calculations to the end of a strategy so its performance can be viewed over time, including stronger and weaker periods.
The document provides example code, but no test results or comparison with other performance measures. Its author notes that the platform’s backtest statistics at the time did not show these monthly and annual figures. The calculations rely on the platform’s capital and strategy profit variables and on detecting period boundaries from daily bars. The note does not explain handling of partial periods, deposits or withdrawals, or whether the percentage denominator should be updated capital, so users should validate the output against their strategy’s accounting conventions.
Key ideas
- The indicator tracks returns for completed calendar years and months.
- It detects new periods from changes in daily date fields.
- Period profit is calculated from strategy profit and a stored starting-capital value.
- The resulting percentage returns are graphed with a zero reference line.
- The document gives no validation results or guidance for deposits and withdrawals.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.