Let
- $T>0$
- $(\Omega,\mathcal A,\operatorname P)$ be a probability space
- $(\mathcal F_t)_{t\in[0,\:T]}$ be a filtration on $(\Omega,\mathcal A)$
- $M$ be an almost surely continuous local martingale on $(\Omega,\mathcal A,\mathcal F,\operatorname P)$ with $M_0=0$ almost surely and $$N:=\left\{\omega\in\Omega:X(\omega)\text{ is not continuous}\right\}\cap\left\{X_0\ne0\right\}$$
- $n\in\mathbb N$, $\tau_0^n:=0$ and $$\tau_k^n:=\inf\left\{t\in(t_{k-1}^n,T]:\left|M_t-M_{\tau_{k-1}^n}\right|=\frac1{2^n}\right\}\wedge T\;\;\;\text{for }k\in\mathbb N$$ with $\inf\emptyset:=\infty$
We can show that $\tau_k^n$ is an $\mathcal F$-stopping for all $k\in\mathbb N$ with $$\tau_k^n\uparrow T\;\;\;\text{for }k\to\infty\tag1$$ on $\Omega\setminus N$. Now, let $$X_t:=\left\{\begin{array}{{{\displaystyle}}l}\displaystyle\sum_{k\in\mathbb N}M_{\tau_{k-1}^n}\left(M_{\tau_k^n\:\wedge\:t}-M_{\tau_{k-1}^n\:\wedge\:t}\right)&&\text{on }\Omega\setminus N\\0&&\text{on }N\end{array}\right\}\;\;\;\text{for }t\in[0,T]\;.$$
We can show that the sum in the definition of $X(\omega)$ has only finitely many terms, for all $\omega\in\Omega\setminus N$.
How can we show that $X$ is a martingale on $(\Omega,\mathcal A,\mathcal F,\operatorname P)$?
You may assume that $M$ is bounded (and hence a martingale), if it's not possible to show the statement otherwise.
Show that each term in the sum is a martingale. To wit, a stopped local martingale is a local martingale, and since $M_{\tau_k^n\wedge t}$ is a.s. bounded (by $k2^{-n}$), each $M_{\tau_k^n\wedge t}$ is a martingale, as is the difference $M_{\tau_k^n\wedge t}-M_{\tau_{k-1}^n\wedge t}$. As this difference vanishes on $[0,\tau_{k-1}^n]$, when you multiply it by a bounded $\mathcal F_{\tau_{k-1}^n}$-measurable random variable, it is still a martingale.