Pairs trading is one of the arbitrage strategies that can be used in trading stocks on the stock market. This paper incorporates pairs trading with the use of cointegration technique to exploit stocks that are temporarily out of equilibrium. In determining which two stocks can be a pair, Banerjee, Dolado, Galbraith and Hendry (1993) and Vidyamurthy (2004) showed that the cointegration technique is more effective than correlation criterion for extracting profit potential in temporary pricing anomalies between two stock prices driven by common underlying factors. By using stationary properties of cointegration errors following an AR(l) process, this paper explores the ways in which the pre-set boundaries chosen to open a trade can influence the minimum total profit over a specified trading horizon. The minimum total profit relates to the pre-set minimum profit per trade and the number of trades during the trading horizon. The higher the pre-set boundaries for opening trades, the higher the profit per trade but the lower the trade numbers. The number of trades over a specified trading horizon is estimated by using the average trade duration and the average inter-trade interval. For any pre-set boundaries, both of these values arc estimated by making an analogy to the mean first-passage time. The aims of this paper are to develop numerical algorithm to estimate the average trade duration, the average inter-trade interval, and the average number of trades and to use these to find optimal pre-set boundaries that maximize the minimum total profit.