Quant research and backtesting

Vectorised backtest

Also called vectorized backtest, array backtest

A backtest that computes signals, positions and returns for the whole history at once as array operations, rather than stepping through events in time.

How it works

Prices sit in a matrix (time by asset), the signal is a function of that matrix, positions are the signal shifted forward by at least one period, and P&L is positions times next-period returns minus a cost term proportional to position changes. This is fast enough to scan thousands of parameter sets, which is also its danger: it invites heavy searching and makes it easy to forget the shift and use same-bar information. It also assumes fills at a chosen price (close, next open) for any size, so it ignores queue position, partial fills and impact unless these are added by hand.

Worked example

Daily returns r and a signal s computed from closes. The correct P&L for day t is position(t-1) x r(t). Writing position(t) x r(t) instead uses the close of day t both to choose the trade and to earn that day's return, and can turn a worthless signal into a high backtested Sharpe ratio.

Put it to work in a timed game.

Practise with Find the Bug

Sources

  1. vectorbt.dev
  2. quantconnect.com/docs/v2/writing-algorithms/key-concepts/algorithm-engi…

Last checked November 2026.

← All 281 glossary terms

Was this definition clear?