Solution (source code)

= Solution

Under the <Black-Scholes model> pricing measure, write $\log S_t/\sigma=B_t+ct$, where $c=(r-\sigma^2/2)/\sigma$. Brownian continuity and immediate crossing on reaching a level make the strict up-crossing time equal almost surely to the hitting time $H_a$. Its finite-time law has no atom at $T$, so the convention before rather than at expiry does not affect the price.

For <truncated discounted Brownian first passage>, since payment occurs at the hitting time, discount there, not at expiry. The <one-touch option> price is
$$
V_0=\mathbb E[e^{-rH_a}\mathbf1\{H_a\leq T\}]=\int_0^T e^{-rt}h_c(t)dt.
$$
Set $d=\sqrt{c^2+2r}=|r+\sigma^2/2|/\sigma$. The expression under the square root is nonnegative for every real $r$, by this Black-Scholes identity. The discounted density satisfies $e^{-rt}h_c(t)=e^{a(c-d)}h_d(t)$. Applying part i yields \b[the closed price]
$$
\boxed{V_0=e^{a(c-d)}\Phi\left(\frac{dT-a}{\sqrt T}\right)+e^{a(c+d)}\Phi\left(\frac{-a-dT}{\sqrt T}\right).}
$$
This formula also covers $d=0$ and negative rates. When $r\geq0$, one may use $d=(r+\sigma^2/2)/\sigma$, so the two prefactors simplify to $e^{-\sigma a}$ and $e^{2ra/\sigma}$. At $r=0$ the expression is the undiscounted hitting probability, as a consistency check.