Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Compare returns from pairs trading against a buy-and-hold strategy

    Hello,

    I am trying to calculate whether pairs trading for data in a given period is a more profitable strategy than a simple buy-and-hold one.

    My dataset is daily, and includes closing prices for a large number of stocks.

    In order to do so, I use the Engle-Granger two step approach to find whether some stock are co-integrated. After doing so, I need to compare whether buying and selling these stocks would be more profitable than simply buying some stock and holding to it.

    In order to calculate return from a given stock series, I think a command of the form below would be appropriate:

    Code:
    bysort FirmID (daily): generate return = log(SharePrice/SharePrice[_n-t])
    .

    Where t is the period under consideration.

    I am a bit unsure on how to go about writing a code for the co-integrated pair though. Can anyone provide some suggestions?

    p.s

    If I want to change the daily dataset into a weekly one and keep, say, only Monday data is there a simple way to do it?

    Thank you all!

  • #2
    Sorry to bother you all again, but is there any possible help on this?

    Comment


    • #3
      You didn't get a quick answer. You'll increase your chances of a helpful answer by following the FAQ on asking questions - provide Stata code in code delimiters, readable Stata output, and sample data using dataex. Also, recognize that most of us are not from your area - explain your problem in terms everyone can understand. You may know what Engle-Granger's approach is, but most of us don't. It is not at all clear what you're trying to do.

      If you do generate the day of the week, you can easily drop every day but Monday - look at the time and date documentation. Alternatively, if you want weekly averages, you can collapse the data by week.

      I don't understand how you're doing co-integration and then doing trading. You can't select a sample based on trends in the sample and then have a reasonable test of a trading strategy on the same data. That is you can't sensibly use the data to determine cointegration and then come back and apply trading rules. Indeed, many of the high-performance strategies are trying to find high levels of positive serial correlation.



      Comment


      • #4
        If I want to change the daily dataset into a weekly one and keep, say, only Monday data is there a simple way to do it?
        Code:
        keep if dow(date) == 1
        Note: This assumes that you have a genuine Stata internal format date variable named date. If you have some other kind of date variable, you need to convert it to Stata internal format first. (-help datetime-)

        Comment

        Working...
        X