# Cointegration and Ratio Pair Trading

I'm having some confusion doing Engle-Granger Cointegration test and then trade the ratio.

Methodology:

1. Run an OLS fit for A and B price time series without a constant. Therefore, $$\hat{Y} = \gamma \cdot P_b + e$$ where $$\hat{Y}$$ is the estimated stock A price and $$P_b$$ the price of stock B. The coefficient $$\gamma$$ would be the hedge ratio. Note that $$e$$ should have mean of 0 as white noise.

2. Get the residuals $$S_t$$ which is $$Y - \hat{Y} = P_a - \gamma \cdot P_b = S_t$$

3. Run ADF test over the $$S_t$$ series to determine if series are cointegrated.

If they are in fact cointegrated, how should the trades be made?

1. Compute the real ratio between the stock A and B prices $$P_a/P_b$$

2. Go long $$1 \cdot A$$ and short $$\gamma \cdot B$$? And viceversa if the signal is go short.

If I want to trade the spread, should I model the OLS as $$ln(A) = -\gamma\cdot ln(B) + e$$ ?

Thanks guys

• A slightly different angle but have you considered looking at lagged cointegration. If you believe that the series are related in some way does one cause the other. Can you receive a signal from a movement in one of the series. – user22485 Dec 5 '18 at 9:59
• Note that $e$ will not have mean 0 in OLS regression that does not include a constant. – Drew Saunders Feb 2 at 1:50

No. In the above equation, you mentioned the spread as the ratio of prices and not of log prices. Also, you verified the spread's cointegration using $$A - \gamma \cdot B$$ and not $$A/B$$ as the input for the ADF test, so you cannot use $$ln(A)-ln(B)$$. If you do this, it means you want to check the spread $$Pa/Pb$$ for cointegration.

1. Calculate the difference $$Pa-(\gamma \cdot Pb)$$ at every time period on the test/simulation data
And you stack your buy and sell orders arithmetically. Meaning you buy 1 lot on $$A$$ and sell $$\gamma$$ on $$B$$ when the spread crosses first standard deviation. When it crosses second standard deviation you buy 2 lots on $$A$$ and sell $$2\cdot \gamma$$ on $$B$$.
If I want to trade the spread, should I model the OLS as $$ln(A)=−γ⋅ln(B)+ \epsilon$$?