Stock pairs trading in R.