Module 02 · Finance · Markets · with code: Python · about 13 min to read
Continue where you left off ×
The Honest Backtest, look-ahead, survivorship and overfitting
The Water Market · Open board
The whole valley on one board: rain as return, drought as a crash, the borrowed bucket and the moon price. This lesson builds the tool everyone uses to ask “what would this have paid?”, and then catches the three ways it lies.
Education, not financial advice.
Before you start. From A Day That Should Never Have Happened, volatility, the bell curve and fat tails : volatility is how widely returns swing. From One Cloud Over Every River, diversification, correlation and Markowitz : mixing assets that do not move together cuts the swing. From What the Valley Pays You to Carry the Drought: risk premium, beta, CAPM and the Sharpe ratio : the Sharpe ratio is return per unit of swing. From The Map Is Not the Territory : a number you steer by stops telling the truth (Goodhart’s law). The code is standard-library Python. You can read the lesson without running it.
The idea in 30 seconds
A backtest replays a rule through past returns to see what it would have paid. It is a simulator, not a forecast.
Max drawdown, the worst fall from a peak, is the number that says whether a person could have stuck with the rule.
Look-ahead bias uses information before it existed. The fix is a lag.
Survivorship bias drops the dead. The fix is the starting list, with the dead kept in.
Overfitting picks the best of many rules on the same data. Only out-of-sample results count, and the number of rules tried must be reported.
Read the story
Lesson 40 of 58 in Finance
The rest of this lesson is part of a plan.
A plan opens every lesson, board, video, lab and paper on chalk. Yearly is $39/year .
See plans Already a member? Sign in
Or start free : a free account opens lessons 2 and 3 of every track.
In this lesson 1995: butter in Bangladesh explains the stock market Backtest: running a rule through the valley’s past The four numbers, and what mixing buys Lie one, look-ahead: trading on news you did not have yet Lie two, survivorship: forgetting the companies that died Lie three, overfitting: 200 rules tried, one reported Terms it explains: backtest, max drawdown, look-ahead bias, survivorship bias, overfitting, out-of-sample, ask, beta, bid, correlation, future, leverage, option, spread, volatility, yield.
Review Finance
Connects to
Cognitive Biases Psychology Compound Interest, the 8th Wonder Mind Blown The Map Is Not the Territory Mind Blown The Sale Made at the Bottom, the behaviour gap Finance A Day That Should Never Have Happened, volatility, the bell curve and fat tails Finance One Cloud Over Every River, diversification, correlation and Markowitz Finance What the Valley Pays You to Carry the Drought: risk premium, beta, CAPM and the Sharpe ratio Finance When Every Model Agreed: tail risk, correlations going to one, and liquidity Finance Mark as read Saved in this browser, and to your account when you sign in.