oculistech / methodology
QF/METHODBacktesting integrity
How we keep backtests honest.
The rules the QuantForge engine follows, the tests that enforce them, the formulas behind every metric, and the limitations you should keep in mind.
M1Event order
Five steps per bar, never reordered.
For each bar t on a shared daily calendar, with one cash account across the universe:
Fill
Orders created at close[t−1] fill at open[t] with adverse slippage. Exits before entries; oversized entries shrink or are rejected.
Stops
Stop, trailing and target checked against high/low[t]. Gaps fill at the open. Both touched → stop first.
Mark
Equity = cash + Σ qty × close[t]; exposure recorded.
Risk
Daily-loss limit flattens at next open; drawdown kill-switch flattens and halts entries.
Signal
Rules read only series[t] and series[t−1]; orders queue for open[t+1]. Nothing fills on the signal bar.
M2Bias controls
Tested, not promised.
The app’s test page runs 46 checks — all passing in the current build — covering indicators, metrics, engine mechanics, integrity and determinism.
- Future-tampering testEvery bar from index 900 onward is perturbed; all signals, fills and equity before bar 900 must be bit-identical for all six library strategies, and all indicator outputs unchanged.
no look-ahead - One-bar fill delayEvery entry fills exactly one bar after its signal, at that bar’s open.
t+1 - Reference indicatorsWilder RSI(14) matches the classic 33-close reference table within ±0.005; MACD and Bollinger identities verified.
RSI ±0.005 - Cost arithmeticBrokerage, % costs, sell-side tax and slippage hand-calculated; final equity = capital + net P&L.
costs - DeterminismSame seed → same dataset checksum; same configuration → identical trades; Monte Carlo reproducible per seed.
seeded
M3Metric formulas
Every number, defined.
Daily simple returns r_t = E_t / E_t−1 − 1; 252 bars per year; rf_d = rf / 252 (default rf 6.5%). Benchmark: frictionless buy-and-hold of the synthetic SYN50 index.
| Metric | Formula |
|---|---|
| Total return | E_end / E_start − 1 |
| CAGR | (E_end / E_start)^(252 / bars) − 1 |
| Volatility | stdev(r) × √252 (sample) |
| Sharpe | mean(r − rf_d) / stdev(r − rf_d) × √252 |
| Sortino | mean(r − rf_d) / √mean(min(0, r − rf_d)²) × √252 |
| Max drawdown | min_t (E_t / max_{s≤t} E_s − 1) |
| Calmar | CAGR / |max DD| |
| Profit factor | Σ winning P&L / |Σ losing P&L| net of costs |
| Ulcer index | √mean(DD%²) |
| WF efficiency | stitched OOS CAGR ÷ mean IS CAGR |
M4Overfitting
The best cell is partly luck.
Test 90 parameter combinations and the winner is selected partly by chance. QuantForge reports how many combinations were tested, how the neighbours of the best cell performed, how the best compares with the median, and what share of cells were positive — then points you to walk-forward testing.

M5Limitations
What the model does not do.
- Daily bars only — true intrabar order is unknown; the model assumes stop-first and gap fills at the open.
- Full-quantity fills: no partial fills, liquidity caps or market impact beyond fixed bps slippage; entries are next-open market orders.
- No borrow fee or margin model for shorts; longs are cash-limited with no leverage.
- Simplified cost model — not an exact fee schedule.
- Synthetic data has no corporate actions, dividends, survivorship effects or holidays.
- Optimisation and walk-forward share one synthetic history; OOS is out-of-sample only in time.
- Monte Carlo treats trade returns as independent and ignores position overlap.
- Portfolio rebalancing is frictionless, though each sleeve’s trading costs are charged.
Hypothetical results. Backtests on synthetic data are illustrations of method. Past or simulated performance does not guarantee future results, and backtests are subject to overfitting, data and model limitations.
Build a strategy. Then try to break it.
Open the QuantForge demo in your browser — synthetic data, a bar-by-bar engine with costs and slippage, and every robustness tool unlocked. No sign-up.