Calculation of second moment of stopping time of a martingale

343 Views Asked by At

I want to calculate second moment of stopping time of random walk (Starting from $k (0 < k < N))$ with absorbing ends at 0 and N.
$P(X_i = 1) = p, P(X_i = -1) = q$ and $p+q = 1$.
$S_n - k = \sum_{1}^{n} X_i$
Stopping time T = min$(T_0,T_N)$.
I am using martingale $(S_n - k - (p-q)n)^2 - 4pqn$. $E[(S_T - k)^2]+(p-q)^2 E[T^2]-2(p-q)E[(S_T - k)T]-4pq E[T]=0$ by Optional stopping theorem.
How to calculate $E[(S_T - k)T]$ ?