1
$\begingroup$

I am currently working on a research project for a pairs trading strategy and would like to know the correct positions to take when a signal has been triggered.
Say we are using this equation to generate signals:
\begin{equation} z = y - \beta x \end{equation} $\mu_z$ = 0, $\sigma_z$ = 0.5, and $\beta$ = 1, for simplicity.
And our signals to open are: (z >= $\mu_z$+$\sigma_z$ & z <= $\mu_z$-$\sigma_z$)
Then a signal will be triggered when :
1) y = 10, x = 9.5
2) y = 10.5, x = 10
3) y = 10, x = 10.5
4) y = 9.5, x = 10

Should the positions taken in these scenarios be different? Should we short 1 share y and go long $\beta$ shares of x for 1 and 2? Should we go long 1 share y and short $\beta$ shares of x for 3 and 4?
Or should we actually be calculating pct change in y and $\beta$x and then short which ever had the greatest pct change and go long the other?

$\endgroup$
  • $\begingroup$ When $z >= mu+k*sigma$ it means that y is "too high" relative to x: you should short y and buy x. Viceversa when $z<=mu-k*sigma$ you should buy y and short x. $\endgroup$ – Alex C Nov 30 '15 at 1:11
2
$\begingroup$

It should be consistent with the way you calculate $\beta:$ if you use stock returns to compute it, then you should be using returns to compute the spread and your signal, and aim to be cash neutral: N $\it{dollars}$ long of x and $\beta\times N$ $\it{dollars}$ short of y. If you regress the prices of x and y to obtain $\beta,$ then pretty much, what you wrote - N $\it{shares}$ of x and $\beta\times N$ $\it{shares}$ of y.

$\endgroup$
0
$\begingroup$

This doesn't answer your question directly, but it may be interesting for you to see a visualization of a pair trading strategy.

I'm the developer of an interactive chart tool for technical analysis that also has a pair strategy function. In my pair trading implementation I'm calculating the mean ratio between the stocks and generating entry signals when the ratio is 2 std. deviations from the mean ratio and exit when 1 stddev. I'm also running cointegration (ADF) and correlation tests that has to pass for the entry signal to be generated.

An "random" example of the strategy is shown in the live interactive chart (link below). The white area shows when a trade is active - and "Algo" shows the return for all trades in total. As shown in the chart for the past 9 months the automated strategy generated 6 trades and all of them gave positive returns including the one that is currently open.

https://bors.e24.no/?qlyze=j5fPryaPUiS1z5pUj1R52yDygE#!/instrument/OSEBX.OSE/analysis

$\endgroup$
  • $\begingroup$ Thank you for the link the chart is a really nice visual and very responsive! Did you write this in javascript? I've recently been generating random series to backtest by starting at some price and multiplying by 1.01 if a random value[0,1] is > 0.50 else multiply by 0.99. It looks as though the "random" series in your chart have higher prob. of moving together. Do you achieve this by basing the probability of series2 increasing/decreasing on whether or not series1 increased/decreased? Also, how are you running ADF test? Is it used on the ratio to test for stationarity? $\endgroup$ – John Faxton Apr 12 '16 at 21:24
  • $\begingroup$ Yes I've written most in Javascript, but some is also translated from C++ to Javascript (asm.js) using the Emscripten compiler. The ADF test is run on the beta-adjusted price-difference of the two stocks. The probability criterias are based on high score from the ADF test, as well as high correlation. If this passes then the stock price ratio is compared to the mean ratio, and a trade is opened if the ratio is 2 std deviations from the mean. Thanks for checking it out! $\endgroup$ – Peter Salomonsen Apr 13 '16 at 11:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.