I'm reading a quantitative trading book"Quantitative Trading with R" by Harry Georgakopoulos.
In the pairs trading section, there's an example that creates the spread and generate buy/sell signals.

y and x are the price changes of two correlated stocks.

data$spread <- y - hedge_ratio*x
threshold <- sd(data$spread, na.rm = TRUE)
# Generate sell and buy signals
buys <- ifelse(data_out$spread > threshold, 1, 0)
sells <- ifelse(data_out$spread < -threshold, -1, 0)

I don't understand why do we buy the spread if spread>threshold... In my opinion, if spread>threshold means it is valuable, so we should sell it but in the example, the spread is bought.



It's a mean reversion play. So if the spread > then the threshold you are betting the spread reverts back. The higher the threshold the fewer amount of times you are betting. I would take a look at how many pairs you are generating with the volatility.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.