The bots assume the Black-Scholes-Merton (BSM) model when calculating probability, which (imperfectly) implies a Gaussian or normal distribution. The bots use a fast polynomial approximation for calculating the probability that's derived from BSM.

## Background

The payoff to a European call option, for example, with a strike price \(K\) at the maturity date \(T\) is

\[c(T) = max[S(T) - K, 0]\]

where \(S(T)\) is the price of the underlying asset at the maturity date. At maturity, if \(S(T) > K\) the option to buy the underlying at \(K\) can be exercised and the underlying asset immediately sold for \(S(T)\) to give a net payoff of \(S(T)−K\). Since the option gives only the right and not the obligation to buy the underlying asset, the option to buy the underlying will not be exercised if doing so would lead to a loss, \(S(T) − K < 0\). The BSM formula for the price of the call option at date \(t = 0\) prior to maturity is given by

\[c(0) = S(0)N(d_1)-e^{-rt}KN(d_2)\]

where \(N(d)\) is the **cumulative probability distribution** for a variable with a **standard normal distribution** with a mean of zero and a standard deviation of one. It is the area under the standard normal density function from** **\(−∞\) to \(d\) and therefore gives the probability that a random draw from the standard normal distribution will have a value less than or equal to \(d\). Therefore, we have \(0 ≤ N(d) ≤ 1\) with \(N(−∞) = 0\), \(N(0) = 0.5\), and \(N(+∞) = 1\). The term \(r\) is the continuously compounded risk-free rate of interest, and variables \(d_1\) and \(d_2\) must satisfy the respective constraints

\[d_1 = \frac{{\ln \left( \frac{S}{K} \right) + \left( r + \frac{\sigma^2}{2} \right) T}}{\sigma \sqrt{T}}\]

\[d_2 = d_1 - \sigma \sqrt{T} \]

where:

\(S\) = Spot price of the underlying asset

\(K\) = Strike price of the option

\(r\) = Risk-free rate

\(\sigma\) = Volatility of the underlying asset

\(T\) = Time to expiration of the option

For more information on the BSM model, see here.

## Polynomial Approximation

The cumulative standard normal distribution is the probability that a number arising from a standard normal distribution lies between \(−∞\) and \(x\). The cumulative standard normal distribution function, which we'll call \(P(x)\), does not have a simple (read fast, in computing terms) analytical solution. Instead, the bots use a **polynomial or rational approximation** of the standard normal (26.2.17; National Bureau of Standards, 1972). The equation is:

\[P(x) = 1 - Z(x)(b_1t + b_2t^2 + b_3t^3 + b_4t^4 + b_5t^5) + \epsilon\]

where,

- \(Z(x)\) is the probability density function for a standard normal distribution, described below
- \(t = \frac{1}{1+px}\) with \(p = 0.2316419\)
- \(b_1 = 0.319381530\)
- \(b_2 = -0.356563782\)
- \(b_3 = 1.781477937\)
- \(b_4 = -1.821255978\)
- \(b_5 = 1.330274429\)
- and \(\epsilon\) is the error estimating \(P(x)\)

The equation is valid for \(0 \leq x < ∞\) and \(|e(x)| < 7.5 * 10^{-8}\).

This function does not describe the probability of observing value \(x\), but the probability of observing any value \(≤ x\). As a result, the cumulative normal distribution function is sometimes described as a normal integral function.

The **probability density function**, \(Z(x)\), is equivalent to the slope of the cumulative distribution - in other words, the rate of increase of \(P\) for a given \(x\).

The BSM analog for the rational approximation \(P(x)\) is \(N(d)\), described above.

The normal probability density function is often confused with the normal distribution function, or is assumed to provide the probability of observing some value, \(x\). In fact, this function only approximates the probability of observing a value within a very small range about \(x\). As a result, when considered over a finite interval, that value can be very much greater than 1, which a probability, by definition, cannot exceed. The function can be described as:

\[Z(x) = \frac {e^{\frac {-(x-μ)^{2}} {2σ^{2}}}}{σ \sqrt{2\pi}}\]

where \(μ\) is the location parameter and \(σ\) is the scale parameter. The case where** **\(μ = 0\) and \(σ = 1\) is called the

**standard normal distribution**. We can therefore simplify the equation for the standard normal distribution:

\[Z(x) = \frac {e^{\frac {-x^{2}} {2}}}{\sqrt{2\pi}}\]

## Probability of Future Price

Bot automations may contain various decisions surrounding the probability of the underlying's price being a specific value at some date in the future. All of these recipes are derived from the same probability formula, \(P(x)\).

The probability function takes the current price, strike price, annual volatility of the underlying, the risk-free rate, and days to maturity as inputs to calculate \(d_1\) and \(d_2\)** **, as described above. The bots will then effectively calculate \(N(d_2)\) from BSM by first solving the

**probability density function**, \(Z(x)\),

**before using all values as inputs to the**

**cumulative probability distribution function**, \(P(x)\).

The outputs of \(P(x)\) and \(Z(x)\) are then used to solve a variety of sub-problems relevant to the specific decision recipes: probability above price \(x\), below price \(x\), between prices \(x\) and \(y\), etc.

In the context of the BSM, \(N(d_1)\) and \(N(d_2)\) represent cumulative standard normal distribution functions applied to \(d_1\) and \(d_2\) variables, respectively. Even though both \(d_1\) and \(d_2\) are derived from underlying asset dynamics, volatility, risk-free rate, and time to expiration, they serve distinctly different purposes. It's important to understand why.

### Role of \(N(d_1)\)

\(N(d_1)\) serves multiple purposes:

1. **Delta:** For a European call option, \(N(d_1)\) is the option's Delta, which signifies the rate of change of option price with respect to the price of the underlying asset.

2. **Hedge Ratio:** \(N(d_1)\) also represents the number of shares needed to hedge against the price change in the option, often termed as the hedge ratio.

3. **Probabilistic Interpretation: **\(N(d_1)\) can be interpreted as the risk-adjusted probability that the option will finish in-the-money under the risk-neutral measure, discounted back to today's value.

### Role of \(N(d_2)\)

\(N(d_2)\), on the other hand, has a more specific role:

1. **Probabilistic Interpretation:** \(N(d_2)\) represents the risk-neutral probability that the option will be exercised, i.e., that the asset will be above the strike price \(K\) at expiration \(T\) for a call option.

2.** Link to Option Price: **\(N(d_2)\) is directly used in the Black-Scholes formula to determine the value of a European call option as:

\[C = S \cdot N(d_1) - K \cdot e^{-rT} \cdot N(d_2)\]

and similarly for a European put option as:

\[P = K \cdot e^{-rT} \cdot (1-N(d_2)) - S \cdot (1-N(d_1))\]

### Key Differences

1. **Sensitivities:** \(N(d_1)\) is more sensitive to changes in the underlying asset's price, given its direct correlation to Delta. \(N(d_2)\) is generally less sensitive to these changes.

2. **Functional Role:** \(N(d_1)\) has a broader set of implications, including hedge ratios and option sensitivities. \(N(d_2)\) is primarily used for pricing and probabilistic assessment related to the strike price.

3. **Mathematical Derivation:** \(d_1\) and \(d_2\) may appear similar, but the minor difference in the terms (presence or absence of \(\frac{\sigma^2}{2}\)) significantly impacts their role in option pricing and risk management.

### How to Interpret \(N(d_1)\) and \(N(d_2)\) in Trading

\(N(d_1)\) can be viewed as the risk-adjusted probability that the option will be exercised, assuming the option is held until expiration and that returns are log-normally distributed. In the context of the Black-Scholes model, this risk adjustment is performed via a drift term equal to the risk-free rate \(r\), implying a risk-neutral valuation.

Mathematically, \(N(d_1)\) can be considered the delta of an option, i.e., the sensitivity of the option's price with respect to a change in the price of the underlying asset.

\(N(d_2)\), on the other hand, is the risk-neutral probability that the option will be exercised, without any further adjustments. This is more straightforward than \(N(d_1)\) and essentially represents the probability that the option will end up in-the-money under the risk-neutral measure.

In simpler terms, \(N(d_2)\) represents the probability that the option will be exercised in a world where all investors are risk-neutral.

While both \(N(d_1)\) and \(N(d_2)\) are derived from the same Black-Scholes formula, their financial interpretations are markedly different. \(N(d_1)\) serves as the risk-adjusted (via risk-free rate) probability for the option ending up in-the-money, whereas \(N(d_2)\) represents the risk-neutral probability of the same. Both are crucial for understanding the behavior and valuation of options within the Black-Scholes framework.

## Probability Decisions on the Underlying

There are several probability-related decisions available when analyzing the security object. Examples include:

- Chance of being above/below \(m\) price in \(n\) days is more/less than \(x%\).
- Chance of being between \(a\) and \(b\) prices in \(n\) days is more/less than \(x%\).

Both decisions use variations of fast polynomial approximation to calculate the final probability of the event occurring. The first use case, the chance of being **below **\(m\) price in \(n\) days, is the output of \(P(x)\). The opposite decision, the chance of being **above **\(m\) price in \(n\) days, is simply \(1 - P(x)\).

In the case of price between prices \(a\) and \(b\), recall that the cumulative standard normal distribution polynomial describes the probability of observing any value \(≤ x\). Therefore, to calculate the chance of falling within a range in \(n\) days, we subtract \(P(x)\) with \(S(T) = a\) from \(P(x)\) with \(S(T) = b\) to determine the final probability.

## Probability Decisions on the Opportunity

There is one probability-related decision available when analyzing Opportunities, either in a decision or as part of Trade Ideas:

- Chance of \({Profit, Max Profit, Max Loss, ITM, etc.}\) is more/less than \(x%\).

Unsurprisingly, we are again calculating the probability of ending up at some price in the future. The only relevant question is, which price and when? For Opportunities, calculations are always made using the number of days to expiration as the input, i.e., we're answering the question, "What is the chance of these things happening *at expiration*?"

The determination of underlying price in relation to profit, max loss, or being ITM is fully dependent on both the strategy type in question and the composite value of the opportunity, given its individual legs (assuming an options strategy).

In the case of a short put spread, for example, the "chance of profit" is determined by the probability the underlying price will be above the break-even price of the spread at expiration. In other words, the probability the spread will make at least a $1 profit. The max loss chance is then determined by the underlying price being below the long put at expiration, and the being ITM chance is determined by the underlying price being below the short strike at expiration.

The same principles are applied to each strategy type. In the case of more complex, multi-legged strategies like iron condors, we use the same probability formula for calculating the chance of price between prices \(a\) and \(b\) to determine the likelihood of the profit range in between the short strikes, max loss range, etc.