Paired Trading Strategy Optimization Using the Reinforcement Learning Method: Intraday Data of Tehran Stock Exchange

Document Type : Research Paper


1 Assistant Prof., Department of Financial Management, Faculty of Management, University of Tehran, Tehran, Iran

2 MSc. Student, Department of Financial Engineering, Faculty of Management, University of Tehran, Tehran, Iran


Objective: Paired trading is among the most well-known and oldest algorithmic trading systems. The efficiency and profitability of this system have been demonstrated in many studies conducted so far in financial markets. Paired trading is principally based on long-run equilibrium relationships or reverting to the mean characteristic. In recent years, a large number of studies have been conducted on algorithmic trading using machine learning.
Methods: In this research, the reinforcement learning method - an appropriate method for modeling and optimizing problems involving different long-run relationships - was used in order to select appropriate trading thresholds and time windows for the purpose of maximizing efficiency and minimizing negative risks in paired trading through adopting the co-integration approach. Results are obtained by applying a combination of reinforcement learning method and co-integration approach in paired trading.
Results: Empirical results based on the intraday dataof paired stocks showed that the reinforcement learning method used to design trading systems in paired trading had significant advantages over the other methods in previous works.
Conclusion: A pair trading strategy with the proposed algorithm can be used as a neutral market strategy in all market conditions, including prosperity and recession, by investors and individual and institutionaltraders.Also, for future research, it is possible to consider transaction costs in a pair trading strategy.


Main Subjects

Bertram, W., (2010). Analytic solutions for optimal statistical arbitrage trading. Physica A, 2010, 389(11), 2234–2243.
Dai, M., Zhang, Q., & Zhu, Q. J. (2010). Trend following trading under a regime switching model. SIAM Journal on Financial Mathematics1(1), 780-810.
Engle, R. F., and Granger, C. W. (1987). Co-integration and error correction: representation, estimation, and testing. Econometrica: journal of the Econometric Society, 251-276.
Gao, X., & Chan, L. (2000). An algorithm for trading and portfolio management using Q-learning and sharpe ratio maximization. In Proceedings of the international conference on neural information processing (pp. 832-837).
Gatev, E., Goetzmann, W. N., and Rouwenhorst, K. G. (2006). Pairs trading: Performance of a relative-value arbitrage rule. Review of Financial Studies, 19(3), 797-827.
Granger, C. W. (1981). Some properties of time series data and their use in econometric model specification. Journal of econometrics, 16(1), 121-130.
Guo, X., & Zhang, Q. (2005). Optimal selling rules in a regime switching model. IEEE Transactions on Automatic Control, 50, 1450–1455.
Hillebrand, E. (2003). A mean-reversion theory of stock-market crashes. Journal of Finance, 41, 591-601.
Johansen, S. (1988). Statistical analysis of cointegration vectors. Journal of economic dynamics and control, 12(2), 231-254.
Lee, J. W., Park, J., Lee, J., & Hong, E. (2007). A multiagent approach to Q-learning for daily stock trading. Systems, Man and Cybernetics, Part A: Systems and Humans, IEEE Transactions on, 37(6), 864-877.
Moody, J., and Saffell, M. (2001). Learning to trade via direct reinforcement. IEEE Transactions on Neural Networks, 12(4), 875–889.
Sutton, R. S., & Barto, A. G. (1998). Introduction to reinforcement learning. MIT Press.
Vidyamurthy, G. (2004). Pairs Trading: quantitative methods and analysis (Vol. 217). John Wiley & Sons.
Won Lee, J. (2001). Stock price prediction using reinforcement learning. In Industrial Electronics, 2001. Proceedings. ISIE 2001. IEEE International Symposium on (Vol. 1, pp. 690-695). IEEE.
Zeng, Z., & Lee, C. G. (2014). Pairs trading: optimal thresholds and profitability. Quantitative Finance, 14(11), 1881-1893.
Zhang, Q. (2001). Stock trading: An optimal selling rule. SIAM Journal on Control and Optimization, 40(1), 64-87.