A Appendix

Optimal Mean Reversion Trading with Transaction Costs and Stop-Loss Exit1


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

1 Introduction

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.

Figure 1: (a) Average log-likelihood plotted against . (b) Historical price paths with maximum average log-likelihood. The solid line plots the portfolio price with longing GLD and shorting GDX, and the dashed line plots the portfolio price with longing GLD and shorting SLV.
GLD-GDX empirical 0.5388 16.6677 0.1599 3.2117
simulated 0.5425 14.3893 0.1727 3.1304
GLD-SLV empirical 0.5680 33.4593 0.1384 3.3882
simulated 0.5629 28.8548 0.1370 3.3898
Table 1: MLE estimates of OU process parameters using historical prices of GLD, GDX, and SLV from August 2011 to May 2012. The portfolio consists of in GLD and - in GDX (resp. - in SLV). For each pair, the second row (simulated) shows the MLE parameter estimates based on a simulated price path corresponding to the estimated parameters from the first row (empirical).

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


for , are (see e.g. p.542 of Borodin and Salminen (2002) and Prop. 2.1 of Alili et al. (2005)):


Direct differentiation yields that , , and . Hence, we observe that both and are strictly positive and convex, and they are, respectively, strictly increasing and decreasing.

Define the first passage time of to some level by . As is well known, and admit the probabilistic expressions (see Itō and McKean (1965) and Rogers and Williams (2000)):


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)).

The candidate optimal exit interval is determined by maximizing the expectation in (3.7). This is equivalent to maximizing (3.10) over and in the transformed problem. This leads to


This is the smallest concave majorant of . Applying the definition of to (3.10), we can express the maximal expected discounted reward as

Remark 3.1

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.

Theorem 3.2

The value function defined in (2.3) is given by


where , and are defined in (3.4), (3.6) and (3.12), respectively.

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 :


Following the steps (3.7)–(3.12) with , , , and replaced by , , , and , respectively, we write down the smallest concave majorant of , namely,

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

We will first study the optimal exit timing in Section 4.1, followed by the optimal entry timing problem in Section 4.2.

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 .

Lemma 4.1

The function is continuous on , twice differentiable on and possesses the following properties:

  1. , and

  2. Let be the unique solution to . Then, we have

    and with


Based on Lemma 4.1, we sketch in Figure 2. The properties of are essential in deriving the value function and optimal liquidation level, as we show next.

Figure 2: Sketches of and . By Lemma 4.1, is convex on the left of and concave on the right. The smallest concave majorant is a straight line tangent to at on , and coincides with on .
Theorem 4.2

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


Proof. From Lemma 4.1 and the fact that as (see also Figure 2), we infer that there exists a unique number such that


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

Applying (4.7) to (4.6), we get


In turn, we obtain the value function by substituting (4.8) into (3.13).  

Next, we examine the dependence of the investor’s optimal timing strategy on the transaction cost .

Proposition 4.3

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

Since , (see (3.3)), and according to Theorem 4.2, we conclude that is increasing in .   

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.

Lemma 4.4

The function is continuous on , differentiable on , and twice differentiable on , and possesses the following properties:

  1. . Let denote the unique solution to , then and

  2. is strictly decreasing if .

  3. Let denote the unique solution to , then and

Figure 3: Sketches of and . The function coincides with on and is equal to the constant on .

In Figure 3, we give a sketch of according to Lemma 4.4. This will be useful for deriving the optimal entry level.

Theorem 4.5

The optimal entry timing problem (2.4) admits the solution


where the optimal entry level is found from the equation


Proof. We look for the value function of the form: , where is the the smallest concave majorant of . From Lemma 4.4 and Figure 3, we infer that there exists a unique number such that


This implies that


Substituting into (4.12), we have

which is equivalent to condition (4.11). Furthermore, using (3.14) and (3.15), we get


To conclude, we substitute of (4.14) and of (3.15) into of (4.13), which by (3.16) yields the value function in (4.10).   

With the analytic solutions for and , we can verify by direct substitution that in (4.2) and in (4.10) satisfy both (3.17) and (3.18).

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.

Proposition 4.6

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.

Remark 4.7

If we set in (2.1), with and fixed, it follows that reduces to a Brownian motion: , . In this case, the optimal liquidation level for problem (2.3) is

and the optimal entry level for problem (2.4) is the root to the equation

5 Incorporating Stop-Loss Exit

Now we consider the optimal entry and exit problems with a stop-loss constraint. For convenience, we restate the value functions from (2.5) and (2.6):