Optimal Mean Reversion Trading
with Transaction Costs and Stop-Loss Exit
Motivated by the industry practice of pairs trading, we study the optimal timing strategies for trading a mean-reverting price spread. An optimal double stopping problem is formulated to analyze the timing to start and subsequently liquidate the position subject to transaction costs. Modeling the price spread by an Ornstein-Uhlenbeck process, we apply a probabilistic methodology and rigorously derive the optimal price intervals for market entry and exit. As an extension, we incorporate a stop-loss constraint to limit the maximum loss. We show that the entry region is characterized by a bounded price interval that lies strictly above the stop-loss level. As for the exit timing, a higher stop-loss level always implies a lower optimal take-profit level. Both analytical and numerical results are provided to illustrate the dependence of timing strategies on model parameters such as transaction costs and stop-loss level.
Keywords: optimal double stopping, mean reversion trading, Ornstein-Uhlenbeck process, stop-loss
JEL Classification: C41, G11, G12
Mathematics Subject Classification (2010): 60G40, 91G10, 62L15
It has been widely observed that many asset prices exhibit mean reversion, including commodities (see Schwartz (1997)), foreign exchange rates (see Engel and Hamilton (1989); Anthony and MacDonald (1998); Larsen and Sørensen (2007)), as well as US and global equities (see Poterba and Summers (1988); Malliaropulos and Priestley (1999); Balvers et al. (2000); Gropp (2004)). Mean-reverting processes are also used to model the dynamics of interest rate, volatility, and default risk. In industry, hedge fund managers and investors often attempt to construct mean-reverting prices by simultaneously taking positions in two highly correlated or co-moving assets. The advent of exchange-traded funds (ETFs) has further facilitated this pairs trading approach since some ETFs are designed to track identical or similar indexes and assets. For instance, Triantafyllopoulos and Montana (2011) investigate the mean-reverting spreads between commodity ETFs and design model for statistical arbitrage. Dunis et al. (2013) also examine the mean-reverting spread between physical gold and gold equity ETFs.
Given the price dynamics of some risky asset(s), one important problem commonly faced by individual and institutional investors is to determine when to open and close a position. While observing the prevailing market prices, a speculative investor can choose to enter the market immediately or wait for a future opportunity. After completing the first trade, the investor will need to decide when is best to close the position. This motivates the investigation of the optimal sequential timing of trades.
In this paper, we study the optimal timing of trades subject to transaction costs under the Ornstein-Uhlenbeck (OU) model. Specifically, our formulation leads to an optimal double stopping problem that gives the optimal entry and exit decision rules. We obtain analytic solutions for both the entry and exit problems. In addition, we incorporate a stop-loss constraint to our trading problem. We find that a higher stop-loss level induces the investor to voluntarily liquidate earlier at a lower take-profit level. Moreover, the entry region is characterized by a bounded price interval that lies strictly above stop-loss level. In other words, it is optimal to wait if the current price is too high or too close to the lower stop-loss level. This is intuitive since entering the market close to stop-loss implies a high chance of exiting at a loss afterwards. As a result, the delay region (complement of the entry region) is disconnected. Furthermore, we show that optimal liquidation level decreases with the stop-loss level until they coincide, in which case immediate liquidation is optimal at all price levels.
A typical solution approach for optimal stopping problems driven by diffusion involves the analytical and numerical studies of the associated free boundary problems or variational inequalities (VIs); see e.g. Bensoussan and Lions (1982), Øksendal (2003), and Sun (1992). For our double optimal stopping problem, this method would determine the value functions from a pair of VIs and require regularity conditions to guarantee that the solutions to the VIs indeed correspond to the optimal stopping problems. As noted by Dayanik (2008), “the variational methods become challenging when the form of the reward function and/or the dynamics of the diffusion obscure the shape of the optimal continuation region.” In our optimal entry timing problem, the reward function involves the value function from the exit timing problem, which is not monotone and can be positive and negative.
In contrast to the variational inequality approach, our proposed methodology starts with a characterization of the value functions as the smallest concave majorant of any given reward function. A key feature of this approach is that it allows us to directly construct the value function, without a priori finding a candidate value function or imposing conditions on the stopping and delay (continuation) regions, such as whether they are connected or not. In other words, our method will derive the structure of the stopping and delay regions as an output.
Our main results provide the analytic expressions for the value functions of the double stopping problems; see Theorems 4.2 and 4.5 (without stop-loss), and Theorems 5.1 and 5.5 (with stop-loss). In earlier studies, Dynkin and Yushkevich (1969) analyze the concave characterization of excessive functions for a standard Brownian motion, and Dayanik and Karatzas (2003) and Dayanik (2008) apply this idea to study the optimal single stopping of a one-dimensional diffusion. In this regard, we contribute to this line of work by solving a number of optimal double stopping problems with and without a stop-loss exit under the OU model.
Among other related studies, Ekstrom et al. (2011) analyze the optimal single liquidation timing under the OU model with zero long-run mean and no transaction cost. The current paper extends their model in a number of ways. First, we analyze the optimal entry timing as well as the optimal liquidation timing. Our model allows for a non-zero long-run mean and transaction costs, along with a stop-loss level. Song et al. (2009) propose a numerical stochastic approximation scheme to solve for the optimal buy-low-sell-high strategies over a finite horizon. Under a similar setting, Zhang and Zhang (2008) and Kong and Zhang (2010) also investigate the infinite sequential buying and selling/shorting problem under exponential OU price dynamics with slippage cost.
In the context of pairs trading, a number of studies have also considered market timing strategy with two price levels. For example, Gatev et al. (2006) study the historical returns from the buy-low-sell-high strategy where the entry/exit levels are set as 1 standard deviation from the long-run mean. Similarly, Avellaneda and Lee (2010) consider starting and ending a pairs trade based on the spread’s distance from its mean. In Elliott et al. (2005), the market entry timing is modeled by the first passage time of an OU process, followed by an exit at a fixed finite horizon. In comparison, rather than assigning ad hoc price levels or fixed trading times, our approach will generate the entry and exit thresholds as solutions of an optimal double stopping problem. Considering an exponential OU asset price with zero mean, Bertram (2010) numerically computes the optimal enter and exit levels that maximize the expected return per unit time. Gregory et al. (2010) also apply this approach to log-spread following the CIR and GARCH diffusion models. Other timing strategies adopted by practitioners have been discussed in Vidyamurthy (2004).
On the other hand, the related problem of constructing portfolios and hedging with mean reverting asset prices has been studied. For example, Benth and Karlsen (2005) study the utility maximization problem that involves dynamically trading an exponential OU underlying asset. Jurek and Yang (2007) analyze a finite-horizon portfolio optimization problem with an OU asset subject to the power utility and Epstein-Zin recursive utility. Chiu and Wong (2012) consider the dynamic trading of co-integrated assets with a mean-variance criterion. Tourin and Yan (2013) derive the dynamic trading strategy for two co-integrated stocks in order to maximize the expected terminal utility of wealth over a fixed horizon. They simplify the associated Hamilton-Jacobi-Bellman equation and obtain a closed-form solution. In the stochastic control approach, incorporating transaction costs and stop-loss exit can potentially limit model tractability and is not implemented in these studies.
The rest of the paper is structured as follows. We formulate the optimal trading problem in Section 2, followed by a discussion on our method of solution in Section 3. In Section 4, we analytically solve the optimal double stopping problem and examine the optimal entry and exit strategies. In Section 5, we study the trading problem with a stop-loss constraint. The proofs of all lemmas are provided in the Appendix.
2 Problem Overview
In the background, we fix the probability space with the historical probability measure . We consider an Ornstein-Uhlenbeck (OU) process driven by the SDE:
with constants , , and state space . Here, is a standard Brownian motion under . Denote by the filtration generated by .
2.1 A Pairs Trading Example
Let us discuss a pairs trading example where we model the value of the resulting position by an OU process. The primary objective is to motivate our trading problem, rather than proposing new estimation methodologies or empirical studies on pairs trading. For related studies and more details, we refer to the seminal paper by Engle and Granger (1987), the books Hamilton (1994); Tsay (2005), and references therein.
We construct a portfolio by holding shares of a risky asset and shorting shares of another risky asset , yielding a portfolio value at time . The pair of assets are selected to form a mean-reverting portfolio value. In addition, one can adjust the strategy to enhance the level of mean reversion. For the purpose of testing mean reversion, only the ratio between and matters, so we can keep constant while varying without loss of generality. For every strategy , we observe the resulting portfolio values realized over an -day period. We then apply the method of maximum likelihood estimation (MLE) to fit the observed portfolio values to an OU process and determine the model parameters. Under the OU model, the conditional probability density of at time given at with time increment is given by
with the constant
Using the observed values , we maximize the average log-likelihood defined by
and denote by the maximized average log-likelihood over , , and for a given strategy . For any , we choose the strategy , where . For example, suppose we invest dollar(s) in asset , so shares is held. At the same time, we short shares in , for . This way, the sign of the initial portfolio value depends on the sign of the difference , which is non-negative. Without loss of generality, we set .
In Figure 1, we illustrate an example based on two pairs of exchange-traded funds (ETFs), namely, the Market Vectors Gold Miners (GDX) and iShares Silver Trust (SLV) against the SPDR Gold Trust (GLD) respectively. These liquidly traded funds aim to track the price movements of the NYSE Arca Gold Miners Index (GDX), silver (SLV), and gold bullion (GLD) respectively. These ETF pairs are also used in Triantafyllopoulos and Montana (2011) and Dunis et al. (2013) for their statistical and empirical studies on ETF pairs trading.
Using price data from August 2011 to May 2012 (, ), we compute and plot in Figure 1 the average log-likelihood against the cash amount , and find that is maximized at (resp. 0.493) for the GLD-GDX pair (resp. GLD-SLV pair). From this MLE-optimal , we obtain the strategy , where and . In this example, the average log-likelihood for the GLD-SLV pair happens to dominate that for GLD-GDX, suggesting a higher degree of fit to the OU model. Figure 1 depicts the historical price paths with the strategy .
We summarize the estimation results in Table 1. For each pair, we first estimate the parameters for the OU model from empirical price data. Then, we use the estimated parameters to simulate price paths according the corresponding OU process. Based on these simulated OU paths, we perform another MLE and obtain another set of OU parameters as well as the maximum average log-likelihood . As we can see, the two sets of estimation outputs (the rows names “empirical” and “simulated”) are very close, suggesting the empirical price process fits well to the OU model.
2.2 Optimal Stopping Problem
Given that a price process or portfolio value evolves according to an OU process, our main objective is to study the optimal timing to open and subsequently close the position subject to transaction costs. This leads to the analysis of an optimal double stopping problem.
First, suppose that the investor already has an existing position whose value process follows (2.1). If the position is closed at some time , then the investor will receive the value and pay a constant transaction cost . To maximize the expected discounted value, the investor solves the optimal stopping problem
where denotes the set of all -stopping times, and is the investor’s subjective constant discount rate. We have also used the shorthand notation: .
From the investor’s viewpoint, represents the expected liquidation value associated with . On the other hand, the current price plus the transaction cost constitute the total cost to enter the trade. The investor can always choose the optimal timing to start the trade, or not to enter at all. This leads us to analyze the entry timing inherent in the trading problem. Precisely, we solve
with , . In other words, the investor seeks to maximize the expected difference between the value function and the current , minus transaction cost . The value function represents the maximum expected value of the investment opportunity in the price process , with transaction costs and incurred, respectively, at entry and exit. For our analysis, the pre-entry and post-entry discount rates, and , can be different, as long as . Moreover, the transaction costs and can also differ, as long as . Moreover, since and are candidate stopping times for (2.3) and (2.4) respectively, the two value functions and are non-negative.
As extension, we can incorporate a stop-loss level of the pairs trade, that caps the maximum loss. In practice, the stop-loss level may be exogenously imposed by the manager of a trading desk. In effect, if the price ever reaches level prior to the investor’s voluntary liquidation time, then the position will be closed immediately. The stop-loss signal is given by the first passage time
Therefore, we determine the entry and liquidation timing from the constrained optimal stopping problem:
Due to the additional timing constraint, the investor may be forced to exit early at the stop-loss level for any given liquidation level. Hence, the stop-loss constraint reduces the value functions, and precisely we deduce that and . As we will show in Sections 4 and 5, the optimal timing strategies with and without stop-loss are quite different.
3 Method of Solution
In this section, we disucss our method of solution. First, we denote the infinitesimal generator of the OU process by
and recall the classical solutions of the differential equation
Direct differentiation yields that , , and . Hence, we observe that both and are strictly positive and convex, and they are, respectively, strictly increasing and decreasing.
A key step of our solution method involves the transformation
Starting at any , we denote by the exit time from an interval with . With the reward function , we compute the corresponding expected discounted reward:
where , , and
The second equality (3.8) follows from the fact that is the unique solution to (3.2) with boundary conditions and . Similar reasoning applies to the function with and . The last equality (3.10) transforms the problem from coordinate to coordinate (see (3.6)).
This is the smallest concave majorant of . Applying the definition of to (3.10), we can express the maximal expected discounted reward as
If , then we have and a.s. In effect, this removes the lower exit level, and the corresponding expected discounted reward is
Consequently, by considering interval-type strategies, we also include the class of stopping strategies of reaching a single upper level (see Theorem 4.2 below).
Next, we prove the optimality of the proposed stopping strategy and provide an expression for the value function.
The proof is provided in Appendix A.1. Let us emphasize that the optimal levels may depend on the initial value , and can potentially coincide, or take values and . As such, the structure of the stopping and delay regions can potentially be characterized by multiple intervals, leading to disconnected delay regions (see Theorem 5.5 below).
We follow the procedure for Theorem 3.2 to derive the expression for the value function in (2.4). First, we denote and (see (3.3)–(3.4)), with discount rate . In addition, we define the transformation
Using these functions, we consider the function analogous to :
From this, we seek to determine the candidate optimal entry interval in the coordinate. Following the proof of Theorem 3.2 with the new functions , , , , and , the value function of the optimal entry timing problem admits the expression
An alternative way to solve for and is to look for the solutions to the pair of variational inequalities
for . With sufficient regularity conditions, this approach can verify that the solutions to the VIs, and , indeed correspond to the optimal stopping problems (see, for example, Theorem 10.4.1 of Øksendal (2003)). Nevertheless, this approach does not immediately suggest candidate optimal timing strategies or value functions, and typically begins with a conjecture on the structure of the optimal stopping times, followed by verification. In contrast, our approach allows us to directly construct the value functions, at the cost of analyzing the properties of , , , and .
4 Analytical Results
4.1 Optimal Exit Timing
We now analyze the optimal exit timing problem (2.3). In preparation for the next result, we summarize the crucial properties of .
The function is continuous on , twice differentiable on and possesses the following properties:
Let be the unique solution to . Then, we have
The optimal liquidation problem (2.3) admits the solution
where the optimal liquidation level is found from the equation
and is bounded below by . The corresponding optimal liquidation time is given by
In turn, the smallest concave majorant is given by
Substituting into (4.5), we have the LHS
and the RHS
Equivalently, we can express condition (4.5) in terms of :
which can be further simplified to
Next, we examine the dependence of the investor’s optimal timing strategy on the transaction cost .
The value function of (2.3) is decreasing in the transaction cost for every , and the optimal liquidation level is increasing in .
Proof. For any and , the corresponding expected discounted reward, , is decreasing in . This implies that is also decreasing in . Next, we treat the optimal threshold as a function of , and differentiate (4.3) w.r.t. to get
In other words, if the transaction cost is high, the investor would tend to liquidate at a higher level, in order to compensate the loss on transaction cost. For other parameters, such as and , the dependence of is generally not monotone.
4.2 Optimal Entry Timing
Having solved for the optimal exit timing, we now turn to the optimal entry timing problem. In this case, the value function is
where is given by Theorem 4.2.
To solve for the optimal entry threshold(s), we will need several properties of , as we summarize below.
The function is continuous on , differentiable on , and twice differentiable on , and possesses the following properties:
. Let denote the unique solution to , then and
is strictly decreasing if .
Let denote the unique solution to , then and
The optimal entry timing problem (2.4) admits the solution
where the optimal entry level is found from the equation
This implies that
Substituting into (4.12), we have
Since the optimal entry timing problem is nested with another optimal stopping problem, the parameter dependence of the optimal entry level is complicated. Below, we illustrate the impact of transaction cost.
The optimal entry level of (2.4) is decreasing in the transaction cost .
Proof. Considering the optimal entry level as a function of , we differentiate (4.11) w.r.t. to get
Since and , the sign of is determined by . Denote . Recall that ,
and smooth pastes at . Since both and are positive decreasing convex functions, it follows that . Observing that and , we have . Applying this to (4.15), we conclude that .
We end this section with a special example in the OU model with no mean reversion.