Discussing the article: "Statistical Arbitrage Through Cointegrated Stocks (Part 2): Expert Advisor, Backtests, and Optimization"

 

Check out the new article: Statistical Arbitrage Through Cointegrated Stocks (Part 2): Expert Advisor, Backtests, and Optimization.

This article presents a sample Expert Advisor implementation for trading a basket of four Nasdaq stocks. The stocks were initially filtered based on Pearson correlation tests. The filtered group was then tested for cointegration with Johansen tests. Finally, the cointegrated spread was tested for stationarity with the ADF and KPSS tests. Here we will see some notes about this process and the results of the backtests after a small optimization.

The drunk, the dog, and the random walk*

When researching cointegration, it is very common to stumble upon an analogy that explains pretty well the fundamental characteristic of cointegrated time series, or cointegrated stock prices, in this case. The analogy says that two non-cointegrated time series are like a drunk man walking with his dog. Their paths fall apart randomly, with no intrinsic, perceived, or measurable logic. The man and the dog can even arrive at home by different pathways, or the dog can even get lost forever.

But two cointegrated time series would be like if the dog were being conducted by a collar, that is, the man is still drunk, his steps are still dangling, but their paths go on together, no matter what. Cointegrated stocks are as if their prices were tied by an “invisible” collar. In the long run, they tend to arrive at home together. The home is the common mean, the mean spread.

Statistical Arbitrage Through Cointegrated Stocks (Part 2): Expert Advisor, Backtests, and Optimization

Author: Jocimar Lopes