from web:
------------
Cross correlation is a standard method of estimating the degree to which two series are correlated. Consider two series x(i) and y(i) where i=0,1,2...N-1. The cross correlation r at delay d is defined as
Where mx and my are the means of the corresponding series.
--------------------
My comment, note that r can be viewed as a function of d. You choose different d to maximize r(d).