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:
.
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!
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!
Comment