How would I price an option when the underlying security is unable to trade above a certain price? I assumed this would be as simple as restricting the limits of integration of the PDF to B (the barrier) instead of infinity but it doesn't work.
For example, if the present price is 30, the barrier is 40, and the strike is 35 then the option price will never exceed $5. If the strike exceeds the barrier the call option is always worthless.
After 5 days and numerous attempts it works for all all possible prices, barriers and strikes
Define barrier to be $p_d$
Strike $p_s$
Present price $p_1$
Criteria:
$p_s \le p_b$
if $p_b \le p_s$ the option is worthless
The barrier has two effects: it makes calls cheaper for all strikes and it can restrict the maximum call price from $p_1$ to something less
But the barrier itself is not a barrier option meaning that the option doesn't become worthless if it's crossed.
The maximum call price $m$ is:
$m=(p_1-g_1)H(p_1-g_1)$
$g_1=p_s-\left[(p_d-p_1)+(p_s+p_1-p_d)H(p_d-p_1-p_s)\right]$
Where H is the heaviside function
This can be tested plugging in various barriers, strikes, and initial prices. If $p_1=30,p_s=35,p_d=40$ then $m=5$
In general, if $p_1 \le p_d-p_s$ then $m=p_1$
And otherwise $m=p_d-p_s$
Between the strike and the barrier you have a restricted black-scholes :
$u=\ln(p_1)+(r-\alpha^2/2)t$
$a=\sqrt{t}\alpha$
$\int_{p_s}^{p_b}{\frac{e^{-rt}(y-p_s)}{ay\sqrt{2\pi}}\exp{\left[-\frac{(\ln(y) - u)^2}{2a^2 }\right]}}\,dy$
As $p_b \to \infty$ you have the classic black-scholes.
As $\alpha,r,t \to \infty$ it goes to zero and the maximum theroetical price $m$ takes over. Otherwise the call is somewhere in-between.
Probability of expiring above the barrier:
$N(d_1)=\int_{p_d}^{\infty}{\frac{e^{-rt}}{p_1a\sqrt{2\pi}}\exp{\left[-\frac{(\ln(y) - u)^2}{2a^2 }\right]}}\,dy$
And a probability below it: $1-N(d_1)$
Evaluating the integrals and substituting:
$\begin{align} d_1 &= \frac{1}{\alpha\sqrt{t}}\left[\ln\left(\frac{p_1}{p_d}\right) + \left(r + \frac{\alpha^{2}}{2}\right)t\right] \\ d_2 &= \frac{1}{\alpha\sqrt{t}}\left[\ln\left(\frac{p_1}{p_d}\right) + \left(r - \frac{\alpha^{2}}{2}\right)t\right] \\ d_3 &= \frac{1}{\alpha\sqrt{t}}\left[\ln\left(\frac{p_1}{p_s}\right) + \left(r + \frac{\alpha^{2}}{2}\right)t\right] \\ d_4 &= \frac{1}{\alpha\sqrt{t}}\left[\ln\left(\frac{p_1}{p_s}\right) + \left(r - \frac{\alpha^{2}}{2}\right)t\right] \\ \end{align} $
The call is:
$\left[mN(d_1)+(p_1(N(d_3)-N(d_1))+p_se^{-rt}(N(d_2)-N(d_4)))(1-N(d_1))\right]H(p_d-p_s)$