- The Log-Normal Distribution CDF transforms a min-max normalized price into the cumulative distribution function of the log-normal distribution, pro...
The Log-Normal Distribution CDF transforms a min-max normalized price into the cumulative distribution function of the log-normal distribution, producing an output in $[0, 1]$. A random variable $X$ is log-normally distributed when $\ln(X)$ follows a normal distribution. This makes the log-normal CDF natural for financial data, where multiplicative returns (log-returns) are approximately normally distributed. The indicator min-max normalizes the source to $(0, 1]$, takes the natural logarithm, standardizes by parameters $\mu$ and $\sigma$, then evaluates the standard normal CDF. The result emphasizes values near the bottom of the recent range (where the logarithm diverges) and compresses values near the top.
## Historical Context
The log-normal distribution was first described by Francis Galton (1879) and formalized by Donald McAlister (1879) in a paper read to the Royal Society. It gained prominence in finance through Louis Bachelier's thesis (1900) on price speculation and was later adopted as the foundation of the Black-Scholes option pricing model (1973), where stock prices are assumed to follow geometric Brownian motion, making the price at any future time log-normally distributed.
The log-normal assumption remains the default model in quantitative finance despite well-documented violations (fat tails, volatility clustering). Its mathematical tractability and the economic argument that prices cannot go negative (the log-normal support is $(0, \infty)$) make it a reasonable first approximation. The CDF form used here provides a probability integral transform: if the normalized price truly followed a log-normal distribution with parameters $\mu$ and $\sigma$, the output would be uniformly distributed on $[0, 1]$.
The implementation reduces the log-normal CDF to the standard normal CDF through the substitution $z = (\ln x - \mu)/\sigma$, then uses the Abramowitz and Stegun rational approximation (formula 7.1.26) for $\Phi(z)$, achieving accuracy of approximately $1.5 \times 10^{-7}$.
## Architecture and Physics
The computation follows a three-phase pipeline:
**Phase 1: Min-max normalization** scans `period` bars for extrema, maps the current source to $x \in [0, 1]$. A floor of $10^{-10}$ is applied to prevent $\ln(0)$.
**Phase 2: Log-standardization** computes $z = (\ln x - \mu) / \sigma$. With default $\mu = 0, \sigma = 1$, this simplifies to $z = \ln(x)$. Since $x \in (0, 1]$, $z \in (-\infty, 0]$, so default parameters place most output in $[0, 0.5]$. Shifting $\mu$ negative or increasing $\sigma$ spreads the output across the full $[0, 1]$ range.
**Phase 3: Normal CDF** evaluates $\Phi(z)$ using the Abramowitz and Stegun approximation with 5 polynomial coefficients:
where $t = 1/(1 + 0.2316419|z|)$ and $\phi(z) = e^{-z^2/2}/\sqrt{2\pi}$.
**Parameter effects**: $\mu$ shifts the inflection point of the S-curve along the logarithmic axis. $\sigma$ controls the steepness: small $\sigma$ produces a sharp transition, large $\sigma$ produces a gradual one. For financial applications, $\mu = -1, \sigma = 0.5$ centers the CDF near the geometric midpoint of the $[0, 1]$ range.
## Mathematical Foundation
If $X \sim \text{LogNormal}(\mu, \sigma^2)$, then $\ln(X) \sim N(\mu, \sigma^2)$, and the CDF is:
$$F(x; \mu, \sigma) = \Phi\!\left(\frac{\ln x - \mu}{\sigma}\right), \quad x > 0$$