Price Probability Distribution

The following functions can be used for estimating the future price development from the current trading prices of option contracts. The result is a distribution of the cumulative price probability at expiration time. The height of a bar in the image below is the probability that the underlying price will end up at or below the given price level, in the implied opinion of option traders.

SPY 2018, cumulative price probability distribution

contractCPD (int Days): int

Generates a cumulative robabililty distribution of the current asset price at the given number of days in the future, and stores it internally. The contractUpdate function must be called before.

cpd(var Price): var

Returns the cumulative probability of the given price. The future price will be at or below the given value with the returned probability in percent. The contractCPD function must be called before.

cpdv(var Percentile): var

Returns the price at the given percentile of the distribution. F.i. cpdv(50) returns the median of the price distribution, with equal probability of a higher or lower price.

Parameters:

 Days Minimum number of calendar days for which the price distribution is estimated. Determines the expiration date of the used options. Price Underlying asset price to be estimated. Percentile Probability that the future price is at or below the returned value.

Remarks:

• The probability distribution is derived from the ask, bid, and strike prices of all option contracts at the determined expiration date. Since ask and bid are subject to fluctuations, the resulting distribution can be irregular.

Example:

```void main()
{
StartDate = 20170101;
BarPeriod = 1440;
PlotScale = 10;

assetList("AssetsIB");
assetHistory("SPY",FROM_STOOQ);
asset("SPY");
Multiplier = 100;

contractUpdate(Stock,0,CALL|PUT);
var PriceCurrent = Contracts->fUnl;
printf("\nCurrent price %.2f",PriceCurrent);

// what's the SPY price in 45 days?
contractCPD(45);
var Price = 0.;
int i;
for(i = 0; i < 150; i++) {
Price += 0.01*PriceCurrent;
plotBar("CPD",i,Price,cpd(Price),BARS|LBL2,RED);
}
printf(", projected price %.2f",cpdv(50));
}```