In his book, "Why Stock Markets Crash", Didier Sornette discusses a trading strategy that exploits return correlations.
Consider a return $r$ that occurred at time $t$ and a return $r'$ that occurred at a later time $t'$, where $t$ and $t'$, are multiples of some time unit (say 5 minutes). $r$ and $r'$ can be decomposed into an average contribution and a varying part. We are interested in quantifying the correlation $C(t, t')$ between the uncertain varying part, which is defined as the average of the product of the varying part $r$ and of $r'$ normalized by the variance (volatility) of the returns, so that $C(t, t' = t) = 1$ (perfect correlation between $r$ and itself).
A simple mathematical calculation shows that the best linear predictor $m_t$ for the return at time $t$, knowing the past history $r_{t-1}, \> r_{t-2}, \ldots ,r_i, \ldots,$ is given by
$$m_t\equiv\frac{1}{B(t, t)}\sum_{i<t} B(i, t)r_i,$$
where each $B(i, t)$ is a factor that can be expressed in terms of the correlation coefficient $C(t', t)$ and is usually called the coefficient $(i, t)$ of the inverse correlation matrix. This formula expresses that each past return $r_i$ impacts on the future return $r_t$ in proportion to its value with a coefficient $B(i, t)/B(t, t)$ which is nonzero only if there is nonzero correlation between time $i$ and time $t$. With this formula, you have the best linear predictor in the sense that it will minimize the errors in variance. Armed with this prediction, you have a powerful trading strategy: buy if $m_t \> > 0$ (expected future price increase) and sell if $m_t < 0$ (expected future price decrease).
I'm trying to solve for $m_t$ given the following dataset...
+----------+-----------------+
| t | r |
+----------+-----------------+
| 15:50:00 | 0.003705090715 |
| 15:51:00 | 0.003873999746 |
| 15:52:00 | 0.002158853672 |
| 15:53:00 | 0.001246754886 |
| 15:54:00 | 0.005646756563 |
| 15:55:00 | -0.001073638262 |
| 15:56:00 | -0.001804395665 |
| 15:57:00 | 0.002322446782 |
| 15:58:00 | 0.001803468933 |
| 15:59:00 | -0.001686730014 |
| 16:00:00 | 0.0008781111203 |
+----------+-----------------+
First I create a matrix for time lags $r_{t}, r_{t-1}, r_{t-2}, r_{t-3}, r_{t-4}$, called $\color{blue}{\mathbf M}$... $$ \begin{bmatrix} \color{blue}{0.00087811} & \color{blue}{-0.00168673} & \color{blue}{0.00180347} & \color{blue}{0.00232245} & -0.0018044 \\ -0.00168673 & 0.00180347 & 0.00232245 & -0.0018044 & -0.00107364 \\ 0.00180347 & 0.00232245 & -0.0018044 & -0.00107364 & 0.00564676 \\ 0.00232245 & -0.0018044 & -0.00107364 & 0.00564676 & 0.00124675 \\ -0.0018044 & -0.00107364 & 0.00564676 & 0.00124675 & 0.00215885 \\ \end{bmatrix} $$ With $\color{blue}{\mathbf M}$ I am able to create a correlation matrix, called $\color{green}{\mathbf C}$... $$ \begin{bmatrix} 1. & \color{green}{-0.15885375} & -0.88120533 & 0.52518141 & 0.32904361 \\ -0.15885375 & 1. & \color{green}{-0.27689212} & -0.87324435 & 0.43345156 \\ -0.88120533 & -0.27689212 & 1. & \color{green}{-0.16496963} & -0.38678436 \\ 0.52518141 & -0.87324435 & -0.16496963 & 1. & \color{green}{-0.18292072} \\ 0.32904361 & 0.43345156 & -0.38678436 & -0.18292072 & 1. \\ \end{bmatrix} $$ and its inverse, called $\color{red}{\mathbf I}$... $$ \begin{bmatrix} \color{red}{678.1834365} & -47.5405215 & 305.9166473 & -205.4095813 & -138.3472675 \\ -47.5405215 & 557.4221492 & 89.6736779 & 245.3640449 & -138.7710611 \\ 305.9166473 & 89.6736779 & 111.2290498 & -89.4926475 & 61.0341470 \\ -205.4095813 & 245.3640449 & -89.4926475 & 323.4950056 & -2.4011426 \\ -138.3472675 & -138.7710611 & 61.0341470 & -2.4011426 & 120.3071511 \\ \end{bmatrix} $$ Next I solve for... $$ \sum_{i<t} \color{green}{B(i, t)}\color{blue}{r_i}, $$ as follows... $$ \color{green}{\mathbf{C}[0][1]} \left( \color{blue}{\mathbf{M}[0][0]} \right) + \color{green}{\mathbf{C}[1][2]} \left( \color{blue}{\mathbf{M}[0][1]} \right) + \color{green}{\mathbf{C}[2][3]} \left( \color{blue}{\mathbf{M}[0][2]} \right) + \color{green}{\mathbf{C}[3][4]} \left( \color{blue}{\mathbf{M}[0][3]} \right) = -0.000394790246734 $$ Finally I multiply by $\frac{1}{B(t,t)}$ which I think is equal to $\color{red}{\mathbf{I}[0][0]}$... $$ \begin{align} m_t & = -0.000394790246734\left( \frac{1}{B(t,t)} \right) \\ & = -0.000394790246734\left( \color{red}{\mathbf{I}[0][0]} \right) \\ & = -0.000394790246734\left( 678.1834365 \right) \\ & = -0.267740206251 \\ \end{align} $$ Did I solve for $m_t$ correctly?