Learn backtesting and strategy validation

Guides to the methods that separate a trading edge from a backtest that fits the past.

Research checks

Start with a backtest, then follow the checks that match your data, validation method and export target.

Start with a backtest

Define the rules, the data and the split before reading a performance number.

How to backtest a trading strategy

A step-by-step method to backtest a trading strategy: data, costs, trade count, out-of-sample tests and the checks that separate an edge from a lucky fit.

In-sample vs out-of-sample testing

The difference between in-sample and out-of-sample testing in trading, how to split the data, and the mistakes that leak test data into the design.

Walk-forward analysis

How walk-forward analysis and walk-forward optimization test a trading strategy on successive unseen windows, with rolling and anchored schemes compared.

Overfitting in trading

What overfitting and curve fitting mean for a trading strategy, how to tell an overfit backtest from a robust one, and the tests that measure it.

Record signal availability

Check when an observation became available, when a signal was formed and when an order could fill.

Look-ahead bias in backtesting

What look-ahead bias is, how it enters a backtest through data, indicators and Pine Script request.security, and how to detect it before you trade.

Point-in-time data and vintages

How data revisions leak into backtests, how ALFRED vintages recover values as published on a past date, and a revised-signal example worked by hand.

Signal timestamps and execution delay

Separate the time a signal is computed from the time its order can fill, with a one-bar shift worked through on daily prices and the latency it omits.

Survivorship bias in backtesting

How a current survivor list distorts historical backtests, a hand-calculated universe example, and checks for delistings and point-in-time membership.

Transaction costs and slippage

Model commissions, spread and slippage on each fill, calculate net return from a round trip, and test how execution assumptions change results.

Test selection and robustness

Separate a repeatable result from a lucky choice among configurations or samples.

Parameter robustness in backtesting

Compare a parameter plateau with an isolated peak, compute a neighborhood average by hand, and relate sensitivity checks to PBO and CSCV.

Purged k-fold and CPCV

How overlapping labels leak across cross-validation folds, how purging and embargo remove them, and how CPCV forms multiple test paths.

Probability of backtest overfitting (PBO)

What the probability of backtest overfitting (PBO) measures, how combinatorially symmetric cross-validation computes it, and how to read a PBO score.

Multiple testing in trading

Compare White's Reality Check, Hansen's SPA, Romano-Wolf StepM and the deflated Sharpe ratio with a hand-calculated false-positive example.

Regime change in backtesting

Test whether a strategy survives changes in return distribution and parameter fit, with a calculated segment example and structural-break diagnostics.

Read performance and risk

Select a statistic that fits the question and examine its sampling uncertainty.

Sharpe vs Sortino ratio

Compare Sharpe and Sortino ratios, calculate each from a small return series, and see why the downside target and observation frequency matter.

Deflated Sharpe ratio

What the deflated Sharpe ratio corrects for, its formula from Bailey and López de Prado, and why a high Sharpe ratio after many trials can still be luck.

Minimum track record length

Derive minimum track record length from a Sharpe estimate, skewness, kurtosis and confidence level, with the published monthly example reproduced.

Monte Carlo simulation for trading

How Monte Carlo simulation stress-tests a trading strategy, what trade shuffling misses, and why block bootstrap keeps the losing streaks that matter.

Monte Carlo permutation test

Define a trading-signal permutation null, compute a finite-sample p-value from shuffled outcomes, and distinguish inference from path simulation.

Prop firm challenge pass probability

How to estimate the probability of passing a prop firm challenge from a strategy's own trades, with daily loss limits, maximum drawdown and profit target.

Check an export before use

Inspect the simulator and the translation limits of a strategy intended for another platform.

Pine Script backtest validation

How TradingView simulates Pine strategy trades, where historical fills and repainting affect results, and how to test selection before export.

MQL5 Expert Advisor robustness testing

How MetaTrader 5 test modes, genetic optimization and forward periods affect Expert Advisor results, with checks before an MQL5 export.

Continue in Stochastly

Documentation explains how the app runs these checks. Research library traces the methods and source material. Interactive tools let you inspect selected calculations.