I have an issue where I go long on a pair trade (want the spread to increase). The difference between the prices decrease, but the calculated spread increases and the zscore decreases. My algorithm thinks it's reverted but it's actually moved further away.
I think this is only happening when the price of Y is less than X. The absolute value of the difference get smaller, but the actual number is a negative number moving up.
Here are my calculations:
I have a series with a hedge ratio of 0.94, mean 6.57, and a standard deviation of 4.03.
I calculate the spread as:
y-hedge*x = 170.19-0.94*179.89 = 1.09
I calculate the zscore as:
(spread - mean)/std = (1.09 - 6.57)/4.03 = 1.359
spread: 5.05 ( 174.11-0.94*179.85 )
zscore: -0.38 ( (5.05-6.57)/4.03))
This movement is opposite of what I want. X went down, Y went up, and the difference between them decreased. However, the spread is larger and the zscore decreases near zero.
Any idea what I'm doing wrong?