strateva.

Articles

When does a backtest count the same day twice?

Why would the same day have two returns in a backtest? The notebook I picked at random tests a rule that buys URTH, a global equity fund, when it detects low volatility and moves to cash when it detects high volatility. Original notebook

Same Monday, two returns

The notebook recalibrates the rule every 63 sessions and tests it over the next 126. Joining the windows yields 1,736 returns for 943 dates. June 8, 2015 shows up with a return of −0.30% in one window and 0.00% in another. Each window starts with its own balance, so deleting a duplicate row leaves those capital resets in place.

One continuous portfolio

I reran the parameter search in Docker and rebuilt the simulation in Strateva. Each day used the latest available settings. I carried forward the previous day's balance and positions and kept the notebook's trading costs.

From March 5, 2015 to November 30, 2018, the portfolio returned 19.26% net versus 25.54% for holding URTH. Its largest decline from a peak was 10.44%, compared with 18.89% for the fund. The portfolio had negative cash balances on some days. The simulation omitted the financing charges for those balances.

If a backtest joins overlapping windows, check two things in the final record. Does each day have one return, and does the portfolio balance carry over into the next window?

What the engine measured

The difference from the reference cannot be told apart from zeroWhat the Strateva engine measured on 945 daily returns. The bars are what was observed; the vertical stroke on the strategy is the range the central 90% fell in when those same returns were resampled in blocks of 10 sessions (1,000 times). The information ratio measures the lead over URTH per unit of risk: its 95% interval runs from −1.16 to 0.75.

Cumulative return

−50%0%50%100%StrategyURTH19.3%25.5%

Worst drawdown from a peak

0%−10%−20%−30%−40%StrategyURTH−10.4%−18.9%

Ratios, with their 95% interval

−2−1012SharpeInformation ratio0.59−0.18
  • Strategy
  • Reference: URTH
  • Resampling range or 95% interval

Source: technical report of the test, linked below. Prices exclude dividends; the resampling uses the same historical series.

The technical report adds the margin of error to these figures. The Sharpe of the strategy was 0.59, with a 95% interval of −0.23 to 1.62. Against URTH, the average annual difference was −1.93%, with a t-statistic of −0.37: it cannot be told apart from zero.

When the same returns were resampled in blocks, the cumulative return fell between −6.95% and 47.34% in the central 90%, and the worst drawdown between 6.14% and 20.48%. What that resampling measures is explained in Block bootstrap and permutation Monte Carlo.

Test reports

The first page of the executive summary
First page of the executive summary of the test. Header "Draft · unsigned evidence". Conclusion: the difference from the reference cannot be told apart from zero with this data; 95% information ratio interval, −1.16 to 0.75. Cumulative return of 19.26% against 25.54% for URTH. Sharpe of 0.59 and worst drawdown of −10.44%.

How to read this document is explained in the guide to the technical report.

How to read both documents is in the guide to the technical report.

If you want to check a rule on your own data, see Strateva's services.

All articlesAll the engine reports

CONTACT

Tell me about your strategy. I will say whether it fits within 48 business hours.

Tell me what you want checked, the asset, the frequency and what you have: rules, a report or code. I will tell you whether it fits and which plan it would be.

What to include in your email

  • Market, instruments and frequency (Spot only).
  • What you want checked, and the period.
  • Language and approximate code size, without pasting the code.
  • What data you have, and whether you need an NDA.

Do not send private code, keys or passwords.

stan@strateva.ai

Reply within 48 h (business days). No private material in the first message. No obligation to commission work.

Who replies

I am Filip Stanciu. I have an MSc in Quantitative Finance from the University of Alcalá, a degree in Finance from the Complutense University of Madrid, and a MiFID II certificate. I have worked in quantitative research for an asset manager, validating stock and ETF strategies. I read and reply to every email myself.

I am not a certification body and I am not a large team. I am one person, and I say so.

Nicolae Filip Stanciu