Let $(X_n)_{n\geq0}$ be a submartingale, $$T_0=0\text{,}\quad S_{n+1}=\inf\{k>T_n:X_k\leq a\}\text{,}\quad T_{n+1}=\inf\{k>S_{n+1}:X_k\geq b\}\text{,}$$ and $U_n=\sup\{k:T_k\leq n\}$ the number of upcrossings of $[a,b]$ before time $n$, for $n=1,2,3,\dots$. Then $$ \mathbf EU_n\leq\frac{1}{b-a}\mathbf E(X_n-a)^+$$ Proof. Let $Y_n=(X_n-a)^+$. Since the function $\phi(x)=(x-a)^+$ is convex and nondecreasing, $(Y_n)$ is a submartingale. Since $S_{n+1}>n$, we obtain: $$\tag{*}Y_n=Y_{S_1\wedge n}+\sum^n_{i=1}(Y_{T_i\wedge n}-Y_{S_i\wedge n})+\sum^n_{i=1}(Y_{S_{i+1}\wedge n}-Y_{T_i\wedge n})\text{.}$$ Each upcrossing of $(X_n)$ between time $0$ and $n$ corresponds to an integer $i$ such that $S_i<T_i\leq n$, with $Y_{S_i}=0$ and $Y_{T_i}=Y_{T_i\wedge n}\geq b-a$, while $Y_{T_i\wedge n}-Y_{S_i\wedge n}\geq 0$ by construction for all $i$. Hence $$\sum^n_{i=1}(Y_{T_i\wedge n}-Y_{S_i\wedge n})\geq(b-a)U_n\text{.}$$ By virtue of (*) we get $$(b-a)U_n\leq Y_n-Y_{S_1\wedge n}-\sum^n_{i=1}(Y_{S_{i+1}\wedge n}-Y_{T_i\wedge n})\text{,}$$ and since $Y_{S_1\wedge n}\geq0$, we obtain $$(b-a)U_n\leq Y_n-\sum^n_{i=1}(Y_{S_{i+1}\wedge n}-Y_{T_i\wedge n})\text{.}$$ Take expectation on both sides: $\color{blue}{\textrm{since }(Y_n)\textrm{ is a submartingale and the stopping times }T_i\wedge n\textrm{ and }S_{i+1}\wedge n\textrm{ are bounded (by }n\textrm{) and }T_i\wedge n\leq S_{i+1}\wedge n\textrm{, we have }\mathbf E(Y_{S_{i+1}\wedge n}-Y_{T_i\wedge n})\geq 0}$
and thus $$(b-a)\mathbf EU_n\leq\mathbf EY_n\text{.}$$
I have two questions about the last paragraph. First, by definition $X_{S_{i+1}}\leq a$ and $X_{T_i}\geq b$, so $Y_{S_{i+1}}-Y_{T_i}\leq0$. How can a negative random variable have positive expectation? Second, is the following proof correct?
Fix $i$. Since $$ Y_{S_{i+1}\wedge n}-Y_{T_i}=\sum^n_{k=1}\sum^n_{l=k+1}(Y_l-Y_k)\unicode{x1D7D9}_{\{S_{i+1}\wedge n=l\text{, }T_i\wedge n=k\}}\text{,}$$ it suffices to show that for $l>k$, $\mathbf E(Y_l-Y_k)\unicode{x1D7D9}_{\{S_{i+1}\wedge n=l\text{, }T_i\wedge n=k\}}\geq 0$. Since $\{S_{i+1}\wedge n=l\text{, }T_i\wedge n=k\}\in\mathcal F_k$ and $(Y_n)$ is a submartingale, $$\begin{align*} \mathbf E(Y_l-Y_k)\unicode{x1D7D9}_{\{S_{i+1}\wedge n=l\text{, }T_i\wedge n=k\}}&=\mathbf E[\mathbf E(Y_l-Y_k\mid \mathcal F_k)\unicode{x1D7D9}_{\{S_{i+1}\wedge n=l\text{, }T_i\wedge n=k\}}]\\ &\geq\mathbf E[(Y_k-Y_k)\unicode{x1D7D9}_{\{S_{i+1}\wedge n=l\text{, }T_i\wedge n=k\}}]=0\text{.} \end{align*}$$