# Pairs trading: Question on non-negative profits, size of the positions and trading signals

I'm trying to backtest Pairs Trading but have become a bit confused on the different methods of selecting pairs, how to look for trading signals and what size of the positions to take in the assets.

What I'm doing right now is that I'm testing for cointegration amongst pairs, which I'm doing with Engle-Granger to get the coefficients in the stationary linear combination of the assets.

$X_t = bY_t+a + \epsilon_t$

After that I check the residual $\epsilon_t = X_t-bY_t-a$ for trading signals. If the absolute value of the residual is larger than some predetermined amount I would open the trade. The trade is closed when the residual is reversed back to 0.

When recieving a signal I want to trade long/short with equal amounts (1 dollar long/short), as in Gatev et al. and many others. But what I realized is that using these signals and this residual you could actually make a loss from a long/short position with equal amounts.

So I tried to figure out how they (Gatev and others) looked for trading signals but everywhere I look it's very poorly explained (especially in their original article). It just says that they use cointegration or OLS or something equivalent and then trade 1 dollar long, 1 dollar short etc.

So what is it that they do? Do they test for stationary in the linear combination without the constant a? $X_t = bY_t + \epsilon_t$

Or is there perhaps any additional condition (in the trading signals) I could add to avoid this potential loss of incuring? Since it depends on the value of the assets at the time of closing I would guess not. Would you recommend looking at some other residual for trading signals?

I know you could take positions 1 and b in the different assets to ensure no trade makes any loss, but this severely complicates the computations of the returns w.r.t. the commited capital, because of that I'd rather not use this method.

Edit:

Since I've been missunderstood I will try to clearify what I'm asking.

The profit from each trade:$P = N_x X_c - N_x X_o + N_y Y_o - N_yY_c$ if you're long in X and short in Y.

Assuming our relationship from the cointegration we have the closing resp. opening we have:

$X_o = bY_o + a + \epsilon_o$ where $\epsilon_o$ is larger than some value U or less than -U. If we're long in X and short in Y this would mean that its less than -U.

$X_c = bY_c + a + \epsilon_c$ where $\epsilon_c$ is larger than 0.

This gives us the profit: $$P = N_x (bY_c + a + \epsilon_c) - N_x (bY_o + a + \epsilon_o) + N_y Y_o - N_yY_c =$$

Lets now say we take positions 1 and b in X resp. Y. This gives us: $$P=\epsilon_c - \epsilon_o > U$$

However, if I would invest equal amounts in each asset the profit would be:

$$P = Y_c/Y_o - X_c/X_o$$

which is not strictly positive. So that's why I asked what Gatev et al. (and others) used to look for trading signals. Do they model the stationary time series as $X_t = bY_t + \epsilon_t$? They mension normalised price series also, but they don't explain in detail what it is that they do, this confuses me and I can't figure it out.

-
Are you seriously asking for trading ideas? – chrisaycock Mar 7 at 23:58
@chrisaycock, is there a way to delineate what constitutes value-added in terms of strategy related questions and what is merely asking others to do the grunt work in terms of strategy profiling and idea generation? I think most recently more and more of the same type of questions are popping up and to be honest I find most a mismatch with the intentions of this site. This particular one looks like a borderline case to me. Any views? – Matt Wolf Mar 8 at 3:48
@Freddy That's the kind of thing you should ask on Meta. – chrisaycock Mar 8 at 3:51
I'm just amidst my education and recently started my studies in math. finance. I was merely trying to understand what's been done in the research of pairs trading, not having someone come up with trading ideas for me (I'm sorry it was interpreted in that way). I don't see why you have to be so condescending, this site isn't exclusively for professionals, is it? – Good Guy Mike Mar 8 at 9:10
What values do you substitute for X & Y? Prices or log prices? – Wisent Genus Mar 9 at 20:27

 What do you mean by that last part? ("you have to choose the values that gives you... cointegration vector"). I know the sizes is different in different models and have different properties. However I wanted to test the 'market neutral' portfolio with equal amounts in each asset, however as I've implemented it now I could still get losses, that's why I asked what residual you could check to avoid this. – Good Guy Mike Mar 8 at 16:11 yo should take a trade with sizes introduced by this vector – restart.localhost.localdomain Mar 10 at 15:23 I'm not completely sure if I follow you, do you mean as Benjamin explained in his comment? But how could I use this to go 1 dollar long/1 dollar short? – Good Guy Mike Mar 10 at 17:29 please give a concrete example of assets and cointegrating relationship (not true coefficients but potential example to know that we are talking about the same) – restart.localhost.localdomain Mar 10 at 18:35 Well, using the cointegration relationship as defined in my question, $X_t$ and $Y_t$ would be the price series of Stock X and Stock Y, and the coefficients could vary.. but lets say b=2, a=10? – Good Guy Mike Mar 10 at 18:49