Random walk
Each day adds a fresh, independent random step. The best forecast of tomorrow is today, and the spread of where you could be grows with the square root of time.
01The formula
- the cumulative log return (or log price) after t days
- the random return on day t, independent of every other day
- the daily volatility: the standard deviation of one day's return
- the number of days
02See it move
03Where it is used
- Quant researcherUses the random walk as the null hypothesis: a signal is only interesting if it beats 'tomorrow equals today'.
- Risk managerScales one-day risk to longer horizons by √T, which assumes returns behave like a random walk.
- Options deskPrices options on the random walk in log prices that sits under geometric Brownian motion.
04Why traders use it
Most prices behave close to a random walk over short horizons. Knowing what pure chance looks like (long trends, scary drawdowns, no real pattern) stops you seeing signals in noise.
05Worked example
With daily volatility 1.5% over 120 days, the formula gives a spread of 16.4%. The 30 simulated paths ended with a spread of 18.9%, and 63% of them finished inside ±σ√T (about 68% would, with many paths).
06How it is built
- Write the change over days as a sum: .
- The steps are independent, so their variances add: .
- Take the square root: the standard deviation is .
- A sum of normal steps is normal, so about 68% of paths end within and 95% within .
07The common mistake
Seeing trends in a random walk. Pure chance produces long runs up or down; a chart that 'clearly trends' over a few months is weak evidence of anything.
08In Python and LaTeX
import numpy as np sigma, T, n = 0.015, 120, 30 rng = np.random.default_rng(7) X = np.cumsum(sigma * rng.standard_normal((n, T)), axis=1) print(round(sigma * np.sqrt(T), 4)) # 0.1643, the spread the ends should have ends_sd = X[:, -1].std(ddof=1) # close to it; differs by sample
X_t = X_{t-1} + \varepsilon_t, \quad \varepsilon_t \sim N(0, \sigma^2) \;\Rightarrow\; \operatorname{sd}(X_T - X_0) = \sigma\sqrt{T}09Where it fits
Rather not code the maths yourself? Describe your trading idea and let AI build the bot.
Build a bot with AgenKitThe worked example and the model run the same code, so every number matches. Models simplify markets on purpose. This is education, not financial advice.