Pairs trading –how to - Meetupfiles.meetup.com/1004673/pairs-trading-how-to.pdfstock, future, or...

38
Pairs trading –how to by Arthur J. Schwartz This talk is an illustration of some of the methods discussed by Tim Bogomolov in a previous talk

Transcript of Pairs trading –how to - Meetupfiles.meetup.com/1004673/pairs-trading-how-to.pdfstock, future, or...

  • Pairs trading –how to by Arthur J. Schwartz

    This talk is an illustration of some of the methods discussed by Tim Bogomolov in a previous talk

  • What is pairs trading?

    • We buy stock A, sell short stock B

    • We are not limited to stocks

    • For example we can go long a short term interest rate future, short a long term interest rate future (or vice versa) to capture expected changes in the yield curve

    • We can do gold versus silver; oil versus gas; corn versus soybeans, and so on

  • How many pairs?

    • If you have N stocks (such as 500 in the S&P 500), you have (N)*(N-1)/2 possible pairs

    • For the 500 stocks in the S&P 500:

    • 500*499/2=124,750 possible pairs

  • My example

    • I downloaded data for ten pairs

    • I chose stocks in the same industry sector

    • How to get a list? One way is to look at Value Line, which groups stocks by industry sector

    • Note that Tim’s methods do not require stocks to be in the same sector

  • How to download data

    • Go to website: finance.yahoo.com

    • At top click Investing, then Get Quotes

    • On left, click Historical Prices

    • Set beginning and ending dates

    • At bottom, click “Download to spread sheet”

  • How the data arrive…

    • 9/29/2011 19.9 20.3 19.8 20.3 40646100

    • Date, open, high low, close, volume

  • What the data look like…

    Date Open High Low Close Volume Adj Close

    9/30/2011 21.93 22.07 21.33 21.34 64453700 21.34

    9/29/2011 22.38 22.6 21.87 22.21 85510500 22.21

    9/28/2011 22.61 22.71 22.3 22.31 74777800 22.31

    9/27/2011 22.5 22.98 22.37 22.54 88206400 22.54

    9/26/2011 22.16 22.44 21.79 22.24 64847800 22.24

    9/23/2011 21.39 22.27 21.22 22.16 74135600 22.16

  • Example

    • INTC, AMD, about 250 closing prices

    • Mean=0.4425=average(log INTC-log AMD)

    • Standard deviation=.0515 =stddev(log values above))

    • Absolute value of CV=0.1165 =stddev/mean

  • Two tools in TOS software for pairs trading

    • Tool one: in TOS charts, we can directly type A-B such as XOM-CVX. Let’s look at a few pars visually……

    • Tool two: in TOS charts, we can apply a study called Correlation. A higher number indicates better correlation although the formula is not shown

  • Looking at pairs visually

    • Note that you can apply any method of picking direction to pairs as you would to any stock, future, or forex

    • For example any technical study – except a study using volume – applies to pairs trading

  • Two ways to use the TOS software for pairs trading

    • Create the chart by typing MOS-POT (symbol one minus symbol two) in the symbol box

    • In TOS Charts, add the correlation study to your chart

  • TOS charts

    • You can do more complicated ratios than one to one. Try typing in IBM-5*MSFT, for example

  • Correlation versus co-integration – what’s the difference?

    • Correlation means that two stocks move synchronously (if A is up, B is up, for example), over the same time frame (which could be daily, weekly or intra-day). There are various formulas in the literature to quantitatively measure correlation.

    • Co-integration means that the difference in price of A & B may temporarily move away from a mean but that the pair display characteristics showing a reversion to the mean.

  • Methods in Tim’s paper

    • Tim presented four methods

    • I’ll only discuss methods one and four because the results of two and three were roughly similar to method one

    • Method one is the easiest to understand

    • However the real money is to be made in method four

  • Method one

    • I took ten pairs and calculated log of closing price of A minus log of closing price B, each day for the past year

    • I took the average & standard deviation of these differences

    • The coefficient of variation of these differences is: standard deviation over average; this indicates the volatility around the average; (then take absolute value)

  • All ten stocks

    • On the next slide, the pair with the lowest standard deviation is highlighted. Tim’s method would pick the “Top 5” which is the five lowest standard deviations

    • I also show the coefficient of variation (standard deviation over mean) as it takes into account the problem of comparing high priced stocks to low priced stocks for ranking the lowest

  • PAIR Mean

    Standard

    deviation

    Coefficie

    ntofvaria

    tion

    (absolute

    value)

    INTC-AMD 0.442573 0.051555778 0.116491

    AMR-LUV -0.28497 0.062455207 0.219163

    VZ-T 0.084237 0.01833625 0.217674

    UPS-FDX -0.09828 0.017624479 0.179321

    HD-LOW 0.170808 0.029047872 0.170061

    STRA-APOL 0.473795 0.092588009 0.195418

    XOM-CVX -0.09729 0.017140062 0.176177

    TGT-WMT -0.01262 0.025037091 1.984578

    WFC-C 0.44021 0.463509377 1.052928

    POT-MOS 0.068724 0.210328057 3.060462

  • Choosing the best pairs – Method One

    • Note that choosing the lowest standard deviation does not result in the same choice as choosing the lowest coefficient of variation

  • Method one, simplified

    • The basic idea is that we’ll take price of stock one minus price of stock two. Tim uses the logs of prices.

    • We’ll do this for hundreds or thousands of pairs. We’ll choose the Top 5 which are the five with the lowest standard deviation

    • We’ll buy and sell equal dollar amounts of each stock. For example, long 100 shares of A, short 80 shares of B

  • Method one continued

    • One problem is that if stock A has a high price – high relative to stock B ---then A’s chart dominates the log A minus log B calculation (compared to two stocks with roughly equal prices). (My solution=choose lowest CV)

    • Example: let’s look at AMZN versus BKS, compared to GOOG versus PCLN . Amazon has a much higher price than Barnes & Noble; Google & Priceline are roughly similar in price

  • Method one results

    • Using the table I created, choosing the lowest standard deviation is not the same as choosing the lowest coefficient of variation (CV). Which is better?

    • The results of the method one in Tim’s paper beat the market but were sensitive to times of high volatility. Also there were extensive times with a flat equity curve

  • Method one – my suggestions to improve

    • Suggestion one. Choose the lowest CV rather than the lowest standard deviation

    • Suggestion two. On the chart of the pair, add lines above and below the pair showing a one standard deviation channel. Count how many times price moved outside that channel, either above or below. Choose the pairs with the most historical “movement”

  • Method four

    • This is where the real money is

    • The basic idea= plot A minus B

    • Define a price increment; say $1, $5, or $10. (The method would be improved if we had a formula or rule of thumb for the price increment.).

    • Calculate the number of turning points where price touched a price increment, then turned.

    • If it blew through one price increment and kept going – that’s counted as “one” not “two”

  • Method four continued

    • We count price increment moves (PIMs) for all our pairs

    • The winners are the pairs with the most PIMs divided by their annual range. Why? Because they’re zigzag-ing the most!

    • We open the pairs trade when price hits an increment

    • We close when price reverts to the mean

  • Method four

    • There is a time stop based on a formula. This might be approximated by a simple rule of thumb such as three weeks.

    • Results for method four showed steady incremental gains to equity over all time periods; returns on equity that significantly exceeded the market; and results were not as affected by market volatility as methods one to three

  • Implementing method four – practical issues

    • High priced pairs will have larger boxes (price increments) than lower priced pairs.

    • Should we use the same price increment for all pairs? In my example, I use $2 for all except one pair where $4 made sense as the range for that pair was wider.

    • Choosing a wider PIM reduces the number of PIMs.

  • Method Four – How To

    • Calculate the annual range, high minus low, from the chart

    • Visually count the number of turns (actually the number of “price increment moves” (PIM) (we’ll illustrate that in a minute)

    • The best pairs have the highest ratio of number of turns to annual range

  • How to define a PIM

    • It’s a move from one price to another in the same direction, by the same price increment (I use $2 in all except one pair, in the example that follows)

    • Example: from 4.00 to 6.00 (or higher); or from 4.00 to 2.00 (or lower)

    • From a practical view, it has to be at the new price for at least three bars and better yet five bars (I use daily bars although weekly or intraday can be used)

  • Why three to five bars?

    • You need time to catch the new price. Three to five bars is arbitrary. Five bars is one trading week.

    • Adopting this rule eliminates a lot of quick gap up or gap down moves, which are hard to catch. See the charts!

    • Pairs often trade in fairly small annual ranges (high minus low) so volatility is much higher than stocks!!!

  • Define A PIM (continued)

    • A “price increment move” is going from one price to another price --- in the same direction

    • Continued movement in the same direction is not counted as a PIM.

    • Let’s look at some of the ten pairs we chose for our example, and count PIMs……

  • Example: if a box is an increment of $1 and a pair goes from 4.00 to 5.00 (or higher) that is counted as one PIM.

    From 4.00 to 5.00 then to 6.00 is still one PIM. But from 4.00 to 5.00, or

    higher, then back down to 4.00 is two PIMs. Note that we only count it as one if it stays at the new price for at

    least five days.

  • The best pairs for Method Four

    • The best pairs will have the most PIMs. We’re going to catch the zigs and zags by establishing a position, long A and short B, (or short A, long B) at the top or bottom of a price increment

    • Think of this conceptually. Let’s say a pair that in the first month moved up exactly one dollar; next month down exactly one dollar; and so on through the year

  • Best pairs (continued)

    • That pair would have eleven PIMs divided by a range of one or a ratio of 11.00.

    • We’d set up a position at the top or bottom of a price increment.

    • Our profits would be significant – if the price behavior continues to zig and zag

    • In the real world our ratios will generally be less than 11.00 and we won’t always catch the top or bottom of a price increment

  • METHOD FOUR --- TABLE ONE

    SYMBOLS NAMEOFSTOCKS INDUSTRY ANNUAL HIGH ANNUAL LOW

    ANNUAL RANGE (OCT 2010-OCT 2011)

    INTC-AMD INTEL-AMD SEMICONDUCTORS 17.81 10.87 6.94

    AMR-LUV AMERICANAIRLINES-SOUTHWEST AIRLINES -4.12 -6.91 2.79

    VZ-T VERIZON-AT&T TELEPHONE & DATA SERVICES 9.21 3.34 5.87

    UPS-FDX UPS-FEDEX PACKAGE DELIVERY 0.1 -24.97 25.07

    HD-LOW HOME DEPOT-LOWES HOME IMPROVEMENT 15.87 6.58 9.29

    STRA-APOL STRAYER-APOLLO EDUCATION 127.11 30.28 96.83

    XOM-CVX EXXON-CHEVRON OIL & GAS -10.2 -28.04 17.84

    TGT-WMT TARGET-WALMART RETAIL DEPT STORES 7.49 -7.63 15.12

    WFC-C WELLS FARGO-CITICORP BANKING 2.87 -19.68 22.55

    POT-MOS POTASH-MOSAIC FERTILIZER -2.42 -28.2 25.78

  • METHOD FOUR - TABLE TWO

    SYMBOLS ANNUAL RANGE (OCT 2010-

    OCT 2011) BOX SIZE (MINIMUM=1) NUMBER OF PIM

    NUMBER OF PIMS/ANNUAL RANGE

    (HIGHER=BETTER)

    INTC-AMD 6.94 2 7 1.008645533

    AMR-LUV 2.79 2 2 0.716845878

    VZ-T 5.87 2 7 1.192504259

    UPS-FDX 25.07 2 7 0.279218189

    HD-LOW 9.29 2 11 1.184068891

    STRA-APOL 96.83 4 14 0.14458329

    XOM-CVX 17.84 2 10 0.560538117

    TGT-WMT 15.12 2 7 0.462962963

    WFC-C 22.55 2 12 0.532150776

    POT-MOS 25.78 2 20 0.77579519

  • Suggestion

    • To explore methods one and four further, we can set up a paper trading account for the group.

    • We can choose one person to calculate the standard deviation and coefficient of variation for fifty pairs. Preferably five people each handling ten pairs, so the calculations do not become too time consuming.

    • We can choose someone else to calculate PIMs for the same pairs (preferably the same five people)

  • Suggestion (continued)

    • We’d need someone else to place the trades, set price and time stops, monitor the trade

    • We’d need to post all this activity to our Discussion Forums

  • Conclusion Thank you for your comments….

    Arthur J. Schwartz