Skip to content
GetProfitable
Search
Dictionary

Vectorised backtest

A backtest computed as array arithmetic over the whole history at once: signals times forward returns. Fast, easy to write, and easy to make wrong.

The core of it is two lines: build a position series from a signal, multiply by next period's returns, sum. A decade of daily data runs in milliseconds, which makes vectorised code the right tool for screening ideas and mapping parameter-sensitivity.

Its limitation is that it cannot represent anything path-dependent inside a bar. Stops, targets, partial fills, position limits that bind, margin calls, and orders that queue are all awkward or impossible, so the results assume perfect frictionless execution at the reference price.

The standard bug is a one-bar shift: multiplying today's signal by today's return instead of tomorrow's. It produces spectacular equity curves and is the single most common form of look-ahead-bias. Assert the shift explicitly rather than trusting the code to be right.

Related: event-driven-backtest, look-ahead-bias, next-bar-execution, fill-assumption

Educational only, not advice. Spotted an error? Post in Site Feedback.