Most correlation calculators use an ‘equal weights’ formula: each data point is given the same weight, whether they are recent or long past. This is an easy calculation that is used for example in the CORREL function in Excel.

In the ‘exponential weights’ formula, the more recent data points are given more weight in the calculation, making it more responsive to recent events and less sensitive to past ones.

The Microsoft and Yahoo stocks recently provided an example of the advantage of the exponentially weighted formula over the equally weighted formula. On Feb 1st, 2008, Microsoft announced a bid over Yahoo stock. Immediately, the daily correlation of returns became negative as the two stocks started moving in opposite directions.

The equally weighted calculation (in the example above, based on 50 days window) takes longer to register the shock, and it has a major flaw: on Apr 14th the the Feb 1st data point is no longer part of the 50 days window, and the correlation surges upwards.

The exponentially weighted calculation on the other hand, is able to better incorporate the Feb 1st shock, because it assigns higher weights to the more recent data points. It reacts more promptly, then absorbs the shock gradually, avoiding any artificial surge.

The above is meant to illustrate the correlation calculation formulas; it does not suggest any trading idea. As a matter of fact, correlation is only a starting point for pairs trading. Cointegration is preferred (and the two stocks have indeed been cointegrated in the last 90 days).