I am trying to learn about pairs trading strategy. I know that we have to long and short cointegrated assests simultaneously. But I still have some confusion in how the strategy works. I wrote the pseudo code for what I think pairs trading strategy is?
x=price data of asset x y=price data of asset y if x and y are correlated and cointegrated calculate pair ratio(spread) x/y or y/x? calculate average of pair ratio(spread) if spread > mean sell asset ? buy asset ? else spread < mean sell asset ? buy asset ? close if else find new pair of assets x and y go to line 1 with new x and y close if
Here I am taking pair ratio(x/y or y/x) as the spread? My first question is which pair ratio should I take x/y or y/x?
if I take
x/y as spread then what assests should I
If I am wrong in my assesment of pseudo code of pair trading then feel free to correct me.