Reproducibility
Every backtest in Quanthop is fully reproducible.
The Guarantee
Given:
- Same strategy code
- Same parameters
- Same data range
- Same configuration
The result will be identical, including:
- Every trade entry/exit
- All metrics (PnL, Sharpe, drawdown, etc.)
- The exact sequence of fills
How It Works
No Hidden State
The engine maintains no state between runs. Each backtest starts fresh.
Deterministic Execution
- Order evaluation follows fixed rules
- Fill prices are calculated, not simulated
- No random number generation
Pre-computed Indicators
Indicators declared in init() are computed once before onBar() runs:
function init(ctx) { ctx.indicator('ema', 'EMA', { period: 20 }); } // By the time onBar runs, ctx.ind.ema contains all values // for all bars - computed deterministically
What Breaks Reproducibility
These patterns will cause different results between runs:
Random numbers
// FORBIDDEN function onBar(ctx, i) { if (Math.random() > 0.5) { ctx.order.market('ASSET', 1); } }
External data
// FORBIDDEN function onBar(ctx, i) { const signal = await fetchExternalAPI(); }
Wall clock time
// FORBIDDEN - uses current time function onBar(ctx, i) { if (new Date().getHours() > 12) { ctx.order.market('ASSET', 1); } }
Verification
You can verify reproducibility:
- Run a backtest
- Note the exact metrics
- Run again with identical settings
- Results must match exactly
If they don't, there's a bug in your strategy (or the platform — please report it).
Why This Matters
Reproducibility enables:
- Valid comparisons — Different parameter sets compared fairly
- Debugging — Isolate issues by reproducing them
- Auditing — Prove results to yourself and others
- Trust — Know that "good" results aren't luck
Related
- Overview — Platform philosophy
Related
enginedeterminismreproducibilityconsistencyqsl