The general case
----------------

We will now return to the most general case with the previous results in mind. Note that (\[Ppm\]) splits into two terms, the first one will count the realizations of the process that reach exercise price [*before*]{} the change in the dynamics, and the second one collects those for which the optimal boundary is hit [*after*]{} it. The first expectation can be reduced to: $${\mathbb{E}}[e^{-r({t^{\pm}}_0-t_0)}{\mathbf 1}_{{t^{\pm}}_0 \leq \tau}|{\mathcal{F}\/}(t_0)]={\mathbb{E}_a}[e^{-(r+\lambda)({t^{\pm}}_0-t_0)}|{\mathcal{F}\/}(t_0)],$$ because $${\mathbb{E}}[{\mathbf 1}_{{t^{\pm}}_0 \leq \tau}|{\mathcal{F}\/}({t^{\pm}}_0)]=1-{\mathbb{P}}\{\tau < {t^{\pm}}_0|{\mathcal{F}\/}({t^{\pm}}_0)\}=e^{-\lambda({t^{\pm}}_0-t_0)},$$ and the pdf of ${t^{\pm}}_0$ is $\psi^{\pm}_a(t;t_0,{S_0},H_a)$, provided that ${t^{\pm}}_0 \leq \tau $. Therefore, we can adapt the result in (\[Eab\]) in order to obtain $${\mathbb{E}_a}[e^{-(r+\lambda)({t^{\pm}}_0-t_0)}|{\mathcal{F}\/}(t_0)]=\left(\frac{{S_0}}{H_a}\right)^{\gamma^{\pm}_{a}},$$ where we have introduced $\gamma^{\pm}_{a}$ which depends on $\lambda$: $$\gamma^{\pm}_{a}=\frac{1}{\sigma^2_a}\left(-\theta_a \pm \sqrt{\theta^2_a+2 (r+\lambda) \sigma^2_a}\right).
\label{gamma}$$

The computation of the second term in (\[Ppm\]) is cumbersome. We will address a simpler problem in the first place, the calculation of ${\mathbb{E}}[e^{-r({t^{\pm}}_0-t_0)}{\mathbf 1}_{{t^{\pm}}_0 > \tau}|{\mathcal{F}\/}(\tau)]$, and after that we will recover the true expression thanks to the following identity: $${\mathbb{E}}[e^{-r({t^{\pm}}_0-t_0)}{\mathbf 1}_{{t^{\pm}}_0> \tau}|{\mathcal{F}\/}(t_0)]= {\mathbb{E}}\left[\left.{\mathbb{E}}[e^{-r({t^{\pm}}_0-t_0)}{\mathbf 1}_{{t^{\pm}}_0> \tau}|{\mathcal{F}\/}(\tau)]\right|{\mathcal{F}\/}(t_0)\right].\label{EEEE}
$$ In order to compute ${\mathbb{E}}[e^{-r({t^{\pm}}_0-t_0)}{\mathbf 1}_{{t^{\pm}}_0> \tau}|{\mathcal{F}\/}(\tau)]$ we must take into account that the indicator selects those trajectories for which either $\widehat{S}^{+}(t)=\max_{t_0\leq t'\leq t} S(t')$, the maximum value of the process, or 