Big announcement!

# Calculating Probability

Probability and chance are used synonymously. Any decision recipes describing the probability or chance of something happening will be calculated by the probability formula described here.

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

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

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 d1 and d2 must satisfy the respective constraints

where σ is the volatility of the underlying asset. 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, 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:

where,

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 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:

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:

## 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 d1​, as described above. The bots will then effectively calculate N(d1) from BSM by first solving the probability density function, Z(xbefore 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.

### On the Underlying

There are two probability-related decisions available when analyzing the security object.

1. Chance of being above/below m price in n days is more/less than x%.
2. 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.

### On the Opportunity

There is one probability-related decision available when analyzing Opportunities:

1. Chance of {profit, max loss, being ITM} 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.

## FAQs 