Level 2 · 110–120 h
Systematic strategies and rigorous backtesting
From hypothesis to honest backtest: statistics for trading, strategy families, vectorised and event-driven engines, and the validation that separates an edge from overfitting.
- Prerequisite
- Solid pandas, OHLCV, returns and drawdown
- Profile
- Data analyst, technical discretionary trader
Statistics and econometrics for trading
2.1.1Hypothesis tests, p-values, bootstrap; multiple regression with robust errors (Newey-West).2.1.2Stationarity: ADF, KPSS; differencing; fractional differencing.2.1.3ARMA and ARIMA models; autocorrelation (ACF, PACF).2.1.4Volatility: ARCH, GARCH, EGARCH, GJR (arch library).2.1.5Cointegration: Engle-Granger, Johansen; mean-reversion half-life (Ornstein-Uhlenbeck).2.1.6Kalman filter for dynamic hedge ratios.2.1.7Regime detection: hidden Markov models (HMM), structural breaks.2.1.8The multiple testing problem: Bonferroni, FDR, “factor zoo”.
Anatomy of a trading system
2.2.1The edge hypothesis: where it can come from (risk, behaviour, structure, information).2.2.2Universe, signal, filter, entry, exit, sizing, risk management.2.2.3Frequencies: intraday, swing, position; strategy capacity.2.2.4Research journal and experiment log, to keep data snooping under control.
Strategy families
2.3.1Trend following (crossovers, Donchian and Turtle breakouts, time series momentum) and cross-sectional momentum or sector rotation.2.3.2Mean reversion: RSI and Bollinger, intraday reversion, gaps.2.3.3Pairs trading and statistical arbitrage: pair selection, distance, cointegration, Kalman.2.3.4Carry (FX, roll yield in futures, bonds), seasonality and calendar effects.2.3.5Factors (value, quality, low volatility, size; long-short) and event strategies (earnings, dividends, index rebalances).2.3.6Introduction to market making: inventory, spread, adverse selection (Avellaneda-Stoikov model).2.3.7Crypto-specific strategies (introduction): crypto momentum, funding and basis arbitrage (covered in detail in level 3).
Backtesting: engines and paradigms
2.4.1Vectorised backtest with pandas and NumPy from scratch, and its limits.2.4.2Event-driven backtest from scratch: loop, portfolio, orders, fills.2.4.3vectorbt: massive parameter sweeps, portfolio simulation.2.4.4backtesting.py and backtrader (teaching tools; maintenance status).2.4.5NautilusTrader: architecture (Rust and Python), data, strategies, the same code in backtest and live.2.4.6LEAN/QuantConnect and Zipline-reloaded; bt for asset allocation.2.4.7Cost modelling: broker commissions, spread, slippage, impact, financing, securities lending.2.4.8Fill modelling: limit orders, queue, partial fills, gaps, stops.
Biases and validation
2.5.1Look-ahead, survivorship, selection, data snooping, narrative bias.2.5.2In-sample and out-of-sample; anchored and rolling walk-forward.2.5.3Combinatorial purged cross-validation (CPCV) for strategies.2.5.4Deflated Sharpe Ratio and Probability of Backtest Overfitting (PBO).2.5.5Monte Carlo: trade resampling, block bootstrap, signal permutations.2.5.6Parameter sensitivity analysis (plateaus versus peaks); robustness across assets and periods.2.5.7Synthetic data (GBM, GARCH, bootstrapping) for stress tests.2.5.8“Honest backtest” checklist before moving to paper trading.
Performance metrics
2.6.1CAGR, volatility, Sharpe, Sortino, Calmar, Omega; maximum drawdown, duration, Ulcer Index.2.6.2Win rate, payoff, expectancy, profit factor; alpha and beta, information ratio, turnover and capacity.2.6.3Reports with QuantStats or pyfolio-reloaded; custom tearsheets.
Research on this site to practise this level