= Solution
For a finite horizon $N$, let $U_N[a,b]$ be the number of completed upcrossings by time $N$. Use the predictable strategy that holds one unit of the process after a visit below $a$ until the next visit above $b$. For a <supermartingale>, the expected gain of this nonnegative predictable <martingale transform> is nonpositive. Pathwise, the completed trades earn at least $(b-a)U_N[a,b]$, while an unfinished final trade can lose at most $(X_N-a)^-$. Hence
$$
(b-a)U_N[a,b]\leq (X_N-a)^-+(H\mathbin\cdot X)_N.
$$
Taking expectations and using $X_N\geq0$ gives the <Doob upcrossing inequality>
$$
(b-a)\mathbb E U_N[a,b]
\leq\mathbb E(X_N-a)^-
\leq a.
$$
As $N\to\infty$, monotone convergence yields
$$
\boxed{\mathbb E U[a,b]\leq\frac a{b-a}}.
$$
Back to article page