I've been trying to wrap my head around cointegration. Currently I use the log returns of both stocks A and B, calculate the spread given by:

$$S = log(A) - n*log(B)$$ where $$n$$ is the Hedge Ratio calculated from a rolling OLS. In the results I've read I've operated under the assumption that if the spread falls below a certain point then long A and short B and vice versa. I believe this is a dollar neutral hedge?

My confusion lies in the Hedge ratio part whereby I'm not sure how to interpret it. I've seen an example that says long A and short $$n$$ stocks of B. However, I sometimes get negative values of $$n$$, i.e log returns are inversely correlated. How do I interpret this?

• A negative $n$ would mean that the stocks are diverging. In that case you don't want to pair trade them. – noob2 May 8 at 19:52
• @noob2 I don't think so. It just means you want to short negative amount of stock = going long both A and B. This is common with say inverse ETFs, but could be a sign of unstable regression coefficients for the ordinary stocks. – LazyCat May 12 at 13:10