The Claude Quant PlaybookDownload ebookDownload ebook

Law of large numbers

beginnerProbability11 of 12

Average enough independent trials and the average settles on the true mean. The typical distance from the truth shrinks like one over the square root of the number of trials.

Build a trading system with Claude.Download ebook

01The formula

the result of trial i, here: 1 if trade i wins and 0 if it loses
the running average after n trials, here: the win rate so far
the true average, here: the true chance of a win p
the standard deviation of one trial, √(p(1 − p)) for a win-or-lose trade

02See it move

03Where it is used

04Why traders use it

It is why a small edge repeated many times becomes a business, and why a short track record proves so little. The √n tells you how much data you need: four times the trades for half the error.

05Worked example

Each trade wins with chance 55%. After 500 trades the orange trader's win rate is 54.4%. The 95% band around the truth is ± 4.4% wide at that point, and 90% of the 20 traders are inside it.

06How it is built

  1. The average has mean , because expectations add.
  2. For independent trials the variances add, so .
  3. The standard deviation of the average is therefore , which goes to 0 as grows.
  4. Chebyshev's inequality then shows the chance of being more than any fixed distance from goes to 0 too.

07The common mistake

The gambler's fallacy: thinking a run of losses makes a win more likely next. The average converges because new trials swamp the old ones, not because the coin corrects itself.

08In Python and LaTeX

import numpy as np
p, n = 0.55, 500
half = 1.96 * np.sqrt(p * (1 - p) / n)
print('95% band: +/-', round(half, 4))  # 0.0436
\bar X_n = \frac{1}{n}\sum_{i=1}^{n} X_i \;\longrightarrow\; \mu \quad \text{as } n \to \infty, \qquad \text{typical error} \approx \frac{\sigma}{\sqrt n}

09Where it fits

Rather not code the maths yourself? Describe your trading idea and let AI build the bot.

Build a bot with AgenKit

The worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.