---
title: "Level 2: systematic strategies and rigorous backtesting"
description: "Level 2 of the Python Trading Course: econometrics, strategy families, backtesting engines, biases, anti-overfitting validation and metrics."
url: "https://pythonparatrading.com/en/python-trading-course/level-2/"
lang: "en"
image: "https://pythonparatrading.com/og/en/python-trading-course/level-2.png"
---

# Level 2: 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.

- Hours: 110–120
- Prerequisite: Solid pandas, OHLCV, returns and drawdown
- Profile: Data analyst, technical discretionary trader
- Course: [Python Trading Course](https://pythonparatrading.com/en/python-trading-course/)

## Statistics and econometrics for trading

- `2.1.1` Hypothesis tests, p-values, bootstrap; multiple regression with robust errors (Newey-West).
- `2.1.2` Stationarity: ADF, KPSS; differencing; fractional differencing.
- `2.1.3` ARMA and ARIMA models; autocorrelation (ACF, PACF).
- `2.1.4` Volatility: ARCH, GARCH, EGARCH, GJR (arch library).
- `2.1.5` Cointegration: Engle-Granger, Johansen; mean-reversion half-life (Ornstein-Uhlenbeck).
- `2.1.6` Kalman filter for dynamic hedge ratios.
- `2.1.7` Regime detection: hidden Markov models (HMM), structural breaks.
- `2.1.8` The multiple testing problem: Bonferroni, FDR, “factor zoo”.

## Anatomy of a trading system

- `2.2.1` The edge hypothesis: where it can come from (risk, behaviour, structure, information).
- `2.2.2` Universe, signal, filter, entry, exit, sizing, risk management.
- `2.2.3` Frequencies: intraday, swing, position; strategy capacity.
- `2.2.4` Research journal and experiment log, to keep data snooping under control.

## Strategy families

- `2.3.1` Trend following (crossovers, Donchian and Turtle breakouts, time series momentum) and cross-sectional momentum or sector rotation.
- `2.3.2` Mean reversion: RSI and Bollinger, intraday reversion, gaps.
- `2.3.3` Pairs trading and statistical arbitrage: pair selection, distance, cointegration, Kalman.
- `2.3.4` Carry (FX, roll yield in futures, bonds), seasonality and calendar effects.
- `2.3.5` Factors (value, quality, low volatility, size; long-short) and event strategies (earnings, dividends, index rebalances).
- `2.3.6` Introduction to market making: inventory, spread, adverse selection (Avellaneda-Stoikov model).
- `2.3.7` Crypto-specific strategies (introduction): crypto momentum, funding and basis arbitrage (covered in detail in level 3).

## Backtesting: engines and paradigms

- `2.4.1` Vectorised backtest with pandas and NumPy from scratch, and its limits.
- `2.4.2` Event-driven backtest from scratch: loop, portfolio, orders, fills.
- `2.4.3` vectorbt: massive parameter sweeps, portfolio simulation.
- `2.4.4` backtesting.py and backtrader (teaching tools; maintenance status).
- `2.4.5` NautilusTrader: architecture (Rust and Python), data, strategies, the same code in backtest and live.
- `2.4.6` LEAN/QuantConnect and Zipline-reloaded; bt for asset allocation.
- `2.4.7` Cost modelling: broker commissions, spread, slippage, impact, financing, securities lending.
- `2.4.8` Fill modelling: limit orders, queue, partial fills, gaps, stops.

## Biases and validation

- `2.5.1` Look-ahead, survivorship, selection, data snooping, narrative bias.
- `2.5.2` In-sample and out-of-sample; anchored and rolling walk-forward.
- `2.5.3` Combinatorial purged cross-validation (CPCV) for strategies.
- `2.5.4` Deflated Sharpe Ratio and Probability of Backtest Overfitting (PBO).
- `2.5.5` Monte Carlo: trade resampling, block bootstrap, signal permutations.
- `2.5.6` Parameter sensitivity analysis (plateaus versus peaks); robustness across assets and periods.
- `2.5.7` Synthetic data (GBM, GARCH, bootstrapping) for stress tests.
- `2.5.8` “Honest backtest” checklist before moving to paper trading.

## Performance metrics

- `2.6.1` CAGR, volatility, Sharpe, Sortino, Calmar, Omega; maximum drawdown, duration, Ulcer Index.
- `2.6.2` Win rate, payoff, expectancy, profit factor; alpha and beta, information ratio, turnover and capacity.
- `2.6.3` Reports with QuantStats or pyfolio-reloaded; custom tearsheets.

## Level project

Two uncorrelated strategies (for example, trend following in futures or ETFs and mean reversion in equities) with a vectorised and an event-driven backtest, realistic costs, walk-forward, Deflated Sharpe and a report that justifies, or discards, each strategy.

## Practice

Research on this site to practise this level

1. [Your first system in Python: moving-average crossover on SPY](https://pythonparatrading.com/en/first-system-moving-average-crossover/)
2. [Zipline in Python - Part 1: Quant Stack and Pipeline](https://pythonparatrading.com/en/zipline-backtesting-with-python-quant-stack/)
3. [Zipline, Backtesting in Python 2: My First Data Analysis](https://pythonparatrading.com/en/backtesting-python-zipline-bundle-2/)
4. [Seasonality in Python II - Backtesting](https://pythonparatrading.com/en/seasonality-intraday-backtesting/)
5. [Intraday Seasonality IV - Field Search](https://pythonparatrading.com/en/seasonality-intraday-optimization/)
6. [Alpha Factors and Alpha Trading in Python](https://pythonparatrading.com/en/alpha-factors-and-alpha-trading-in-python/)

Previous level: [Level 1: Financial data, markets and analysis](https://pythonparatrading.com/en/python-trading-course/level-1/)

Next level: [Level 3: Derivatives: futures, spreads, forex and options](https://pythonparatrading.com/en/python-trading-course/level-3/)
