A Closed-Form Solution For Optimal Mean-Reverting Trading Strategies
A Closed-Form Solution For Optimal Mean-Reverting Trading Strategies
strategies
Alexander Lipton and Marcos Lopez de Pradoy
Abstract
When prices re‡ect all available information, they oscillate around an equilibrium level. This oscil-
lation is the result of the temporary market impact caused by waves of buyers and sellers. This price
behavior can be approximated through an Ornstein-Uhlenbeck (OU) process.
Market makers provide liquidity in an attempt to monetize this oscillation. They enter a long position
when a security is priced below its estimated equilibrium level, and they enter a short position when
a security is priced above its estimated equilibrium level. They hold that position until one of three
outcomes occur: (1) they achieve the targeted pro…t; (2) they experience a maximum tolerated loss; (3)
the position is held beyond a maximum tolerated horizon.
All market makers are confronted with the problem of de…ning pro…t-taking and stop-out levels. More
generally, all execution traders acting on behalf of a client must determine at what levels an order must be
ful…lled. Those optimal levels can be determined by maximizing the trader’s Sharpe ratio in the context
of OU processes via Monte Carlo experiments, [35]. This paper develops an analytical framework and
derives those optimal levels by using the method of heat potentials, [31, 32].
1 Introduction
Mean-reverting trading strategies in various contexts have been studied for decades, see, e.g., [43, 14, 15,
17, 21, 25, 26, 27, 18, 16, 41]. For instance, Elliott et al. explained how mean-reverting processes might
be used in pairs trading and developed several methods for parameter estimation, [13]. Avellaneda and Lee
used mean-reverting processes for pairs trading, and modeled the hitting time to …nd the exit rule of the
trade, [1]. Bertram developed some analytic formulae for statistical arbitrage trading where the security
price follows an Ornstein–Uhlenbeck (O-U) process, [6, 7]. Lindberg and his coauthors model the spread
between two assets as an O-U process and study the optimal liquidation strategy for an investor who wants
to optimize pro…t over the opportunity cost, [12, 11, 23, 29]. Lopez de Prado (Chapter 13) considered trading
rules for discrete-time mean-reverting trading strategies and found optimal trading rules using Monte Carlo
simulations, [35].
By its very nature, the energy market is particularly well suited to mean-reverting trading strategies.
Numerous researchers discuss these strategies, see, e.g., [8, 5, 28], among others.
Usually, it is assumed that the stochastic process underlying mean-reverting trading strategies is the
standard O-U process. However, in practice, jumps do play a major role. Hence, some attention had been
devoted to Lévy-driven O-U processes, see, e.g., [23, 16, 10]. Although Endres and Stübinger, [10], present
a fairly detailed exposition, their central equation (9) is incorrect because it ignores the possibility of a
Lévy-driven O-U process to overshoot the chosen boundaries.
We emphasize that most, if not all, analytical results derived by the above authors, are asymptotic and
valid for perpetual trading strategies only, see, e.g., [6, 7, 12, 11, 24, 23, 29, 45, 2]. While interesting from a
theoretical standpoint, they have limited application in practice. In contrast, our approach deals with …nite
maturity trading strategies, and, because of that, has immediate applications.
The Jerusalem School of Business Administration, The Hebrew University of Jerusalem, Jerusalem, Israel; Connection Sci-
ence and Engineering, Massachusetts Institute of Technology, Cambridge, MA, USA; Investimizer, Chicago, IL, USA; SilaMoney,
Portland, OR, USA. E-mail: [email protected]
y Operations Research and Information Engineering, Cornell University, New York, NY, USA; Investimizer, Chicago, IL,
USA; True Positive Technologies, New York, NY, USA. E-mail [email protected]
2 De…nitions of variables
Suppose an investment strategy S invests in i = 1; :::I opportunities or bets. At each opportunity i, S takes
a position of mi units of security X, where mi 2 ( 1; 1). The transaction that entered such opportunity
was priced at a value mi Pi;0 , where Pi;0 is the average price per unit at which the mi securities were
transacted. As other market participants transact security X, we can mark-to-market (MtM) the value of
that opportunity i after t observed transactions as mi Pi;t . This represents the value of opportunity i if it
were liquidated at the price observed in the market after t transactions. Accordingly, we can compute the
MtM pro…t/loss of opportunity i after t transactions as i;t = mi (Pi;t Pi;0 ).
A standard trading rule provides the logic for exiting opportunity i at t = Ti . This occurs as soon as one
of two conditions is veri…ed:
where E0 [Pi;Ti ] is the forecasted price and Pi;0 is the entry level of opportunity i.
3 Parameter estimation
Consider the discrete O-U process on a price series fPi;t g:
such that the random shocks are IID distributed "i;t N (0; 1). The seed value for this process is Pi;0 ,
the level targeted by opportunity i is E0 [Pi;Ti ], and determines the speed at which Pi;0 converges towards
E0 [Pi;Ti ].
We estimate the input parameters f ; g, by stacking the opportunities as:
T
X = (E0 [P0;T0 ] P0;0 ; E0 [P0;T0 ] P0;1 ; :::; E0 [P0;T0 ] P0;T 1 ; :::; E0 [PI;TI ] PI;0 ; :::; E0 [PI;TI ] PI;T 1) ;
T
Y = (P0;1 E0 [P0;T0 ]; P0;2 E0 [P0;T0 ]; :::; P0;T E0 [P0;T0 ]; :::; PI;1 E0 [PI;TI ]; :::; PI;T E0 [PI;TI ]) ;
T
where (:::) denotes vector transposition. Applying OLS on the above equation, we can estimate the original
O-U parameters as follows:
r h i
cov[Y;X] ^
^ = cov[X;X] ; = Y ^ X; ^ = cov ^; ^ ;
where, as usual, cov [:; :] is the covariance operator. We use the above estimations to …nd optimal stop-loss
and take-pro…t bounds.
and a trading rule R = f 0 ; 0 ; T 0 g, 0 < 0, 0 > 0. It is important to understand what are the natural units
associated with the O-U process (1). To this end we can use its steady-state.p The steady-state expectation
of the above process is , while its standard deviation is given by 0 = 0 = 2 0 .
As usual, an appropriate scaling is helpful to remove super‡uous parameters. To this end, we de…ne
p p p p 0
0 0 0 0 0 0 0 0 0 pE F0
t= t; T = T 0; x= 0 x0 ; = 0 ; = 0
0
; = 0 ; E= 0 0
; F = 0 02 ;
and get
dx = ( x) dt + dWt ;
in the domain
x ; 0 t T:
p
The steady-state distribution has the expectation of , and the standard deviation = 1= 2.
According to the trading rule, we exit the trade either when: (A) the price hits to take pro…t; (B) the
price hits to stop losses; (C) the trade expires at t = T . For a short investment strategy, the roles of f ; g
are reversed - pro…ts equal to are taken when when the price hits , and losses equal are realized
E (t; ) = t ; E (t; ) = t ;
x
E (T; x) = T;
x2
F (T; x) = T2 ;
and
Gt (t; x) + ( x) Gx (t; x) + 21 Gxx (t; x) = 0;
G (t; ) = t; G (t; ) = t;
G (T; x) = T;
We represent the SR and DUR as
E(0;0)
SR = p ;
F (0;0) (E(0;0))2
DUR = G (0; 0) :
We wish to use the method of heat potentials to solve the above TBVPs. First, we de…ne
=T t;
and get initial boundary value problems (IBVPs):
E ( ; x) = ( x) Ex ( ; x) + 12 Exx ( ; x) ;
E( ; )= (T ); E( ; )= (T );
x
E (0; x) = T;
x2
F (0; x) = T2 ;
G ( ; x) = ( x) Gx ( ; x) + 21 Gxx ( ; x) ;
G ( ; ) = (T ); G ( ; ) = (T );
G (0; x) = T;
E(T;0)
SR = p ;
F (T;0) (E(T;0))2
DUR = G (T; 0) :
Second, we de…ne
2
1 e
= 2 ; =e (x );
so that p
@ = (1 2 )@ @ ; @x = 1 2 @ :
Accordingly,
E ( ; ) = 21 E ( ; ) ;
2 2
E ; ( ) = (1 2 ) ; E ; ( ) = (1 2 ) ;
ln( (1 2 ) ) ln( (1 2 ) )
2( + )
E (0; ) = ln(1 2 ) ;
F ( ; ) = 12 F ( ; ) ;
2 2
4
F ; ( ) = (1 2 ) 2 ; F ; ( ) = (1 2 ) 2 ;
(ln( (1 2 ) )) (ln( (1 2 ) ))
4( + )2
F (0; ) = (ln(1 2 ))2
;
G ( ; ) = 21 G ( ; ) ;
1 (1 2 ) 1 (1 2 )
G ; ( ) = 2 ln (1 2 ) ; G ; ( ) = 2 ln (1 2 ) ;
1
G (0; ) = 2 ln (1 2 );
E( ;$)
SR = p ;
F ( ;$) (E( ;$))2
DUR = G ( ; $) :
Here 2T p
1 e
= 2 ; $= 1 2 ;
p p
( )= 1 2 ( ); ( )= 1 2 ( ):
As usual, we have to account for the initial conditions. To this end, we introduce
^( ; )=E( ; )+ 2( + )
E ln(1 2 ) ;
4( +( + )2 )
F^ ( ; ) = F ( ; ) (ln(1 2 ))2
;
^ ( ; ) = G( ; ) +
G 1
ln (1 2 );
2
^( ;
E ( )) = e ( ) ; ^
E ; ( ) = e( );
^ (0; ) = 0;
E
F^ ( ; ) = 21 F^ ( ; ) ;
F^ ( ; ( )) = f ( ) ; F^ ; ( ) = f ( );
F^ (0; ) = 0;
^ ( ; ) = 1G
G ^ ( ; );
2
^( ;
G ( )) = g ( ) ; ^
G ; ( ) = g( );
^ (0; ) = 0;
G
where
2 2( ( )+ ) 2 2( ( )+ )
e( ) = (1 2 ) + ln(1 2 ) ; e( ) = (1 2 ) + ln(1 2 )
ln( (1 2 ) ) ln( (1 2 ) )
4 2 4( +( ( )+ )2 ) 4 2 4( +( ( )+ )2 )
f( )= (1 2 ) 2
(ln(1 2 ))2
; f( )= (1 2 ) 2
(ln(1 2 ))2
;
(ln( (1 2 ) )) (ln( (1 2 ) ))
1 1
g( ) = 2 ln (1 2 ); g( ) = 2 ln (1 2 ):
Accordingly,
^ ;$) 2($+ )
E( ln(1 2 )
SR = r
4( +ln(1 2 )($+ )E(^ ;$))
; (2)
2
F^ ( ;$) ^
(E( ;$)) + (ln(1 2 ))2
^ ( ; $)
DUR = G 1
ln (1 2 ):
2
After the above transformations are performed, the problem becomes solvable by the method of heat
potentials.
Z ( ( ) ( ))2
p1
( ( ) ( ))e 2( )
"( ) + 2 ( )3=2
"( )d
0
(4)
Z ( ( ) ( ))2
( ( ) ( ))e 2( )
+ p12 ( )3=2
"( )d = e( );
0
^( ; )= p1
( ( ))e 2( )
p1
( ( ))e 2( )
E 2 ( )3=2
"( )d + 2 ( )3=2
"( )d : (5)
0 0
Z ( ( ) ( ))2
p1
( ( ) ( ))e 2( )
( )+ 2 ( )3=2
( )d
0
(7)
Z ( ( ) ( ))2
( ( ) ( ))e 2( )
+ p12 ( )3=2
( )d = f ( );
0
Z ( ( ))2 Z ( ( ))2
( ( ))e 2( ) ( ( ))e 2( )
F^ ( ; ) = p1
2 ( )3=2
( )d + p1
2 ( )3=2
( )d : (8)
0 0
In particular,
Z ($ ( ))2 Z ($ ( ))2
^ ( ; $) = p1
($ ( ))e 2( )
p1
($ ( ))e 2( )
E 2 ( )3=2
"( )d + 2 ( )3=2
"( )d ;
0 0
Z ($ ( ))2 Z ($ ( ))2
($ ( ))e 2( ) ($ ( ))e 2( )
F^ ( ; $) = p1
2 ( )3=2
( )d + p1
2 ( )3=2
( )d :
0 0
It is important to notice that (" ( ) ; " ( )) and ( ) ; ( ) are singular at = . However, due to
2
the dampening impact of the exponents exp $ ( ) =2 ( ) , the corresponding integrals still
converge.
We now know E ^ ( ; $) ; F^ ( ; $) and calculate the SR by using Eq. (2). G^ ( ; $) and DUR can be
calculated in a similar fashion.
6 Numerical method
To compute the SR, we need to …nd E( ^ ; $) and F^ ( ; $), and then apply Eq. (2). E( ^ ; $) and F^ ( ; $)
can be computed using Eqs (5) and (8) by simple integration with pre-computed ("; ") and ; . In this
section, we develop a numerical method to compute these quantities by solving Eqs (3)–(4), and (6)–(7) by
extending the methods described in Lipton and Kaushansky, [31, 32]. For illustrative purposes we develop
a simple scheme based on the trapezoidal rule for Stieltjes integrals.
We want to solve a generic system of the form:
R 1;1 R
1
( ) + 0 Kp ( s;s) 1 (s) ds + 0 K 1;2 ( ; s) 2 (s) ds = 1 ( );
2
R R K 2;2 ( ;s) 2
( )+ 0
K 2;1 ( ; s) 1
(s) ds + 0
p
s
(s) ds = 2
( );
( ) (s) ( ( ) (s))2
K 1;2 ( ; s) = p1 exp ;
2 ( s)3=2 2( s)
( ) (s) ( ( ) (s))2
K 2;1 ( ; s) = p1 exp ;
2 ( s)3=2 2( s)
( ) (s) ( ( ) (s))2
K 2;2 ( ; s) = p1 exp :
2 s 2( s)
It is clear that
( ) (s)
K 1;1 ( ; ) = p1 lims! = p p ;
2 s 2 1 2
K 1;2 ( ; ) = 0;
K 2;1 ( ; ) = 0;
( ) (s)
K 2;2 ( ; ) = p1 lims! = p p :
2 s 2 1 2
We can equally rewrite the relevant integrals as Stieltjes integrals
1
R p R
( ) 2 0 K 1;1 ( ; s) 1 (s) d s + 0 K 1;2 ( ; s) 2
(s) ds = 1
( );
2
R R p
( )+ 0
K 2;1 ( ; s) 1
(s) ds 2 0
K 2;2 ( ; s) 2
(s) d s= 2
( ):
Consider a grid 0 = 0 < 1 < : : : < n = , and let k;l = k l . Then, using the trapezoidal rule for
approximation of integrals, we get the following approximation of last two equations:
1
Pk (Kp1;1 1 1;1 1
i +Kk;i 1 i 1 ) 1 1;2 2 1;2 2 1
k + i=1
k;i
p + 2 Kk;i i + Kk;i 1 i 1 i;i 1 = k;
( k;i + k;i 1 )
2
Pk 1 2;1 1 2;1 1 (Kp2;2 2 2;2 2
i +Kk;i 1 i 1 ) 2
k + i=1 2 Kk;i i + Kk;i 1 i 1 + k;i
p i;i 1 = k:
( k;i + k;i 1 )
where
i = ( i) ; i = ( i) ; Kk;j; = K ;
( k; i ); ; = 1; 2:
Taking into account that
1 2
1 2 1 2 1 2
0; = 0; ; 1; = ; ;
1 1
0 0 1 1;1 p 2;2 p
(1+K1;1 1 ) (1 K1;1 1 )
1 2 1 2 1 2
and assuming that 2; 2 ;:::; k 1; k 1 have been computed, we can easily …nd k; k :
1 1;1 p 1
1 1;1 1
p 1 1;2 2
k = 1 + Kk;k k;k 1 k Kk;k 1 k 1 k;k 1 2 Kk;k 1 k 1 k;k 1
Pk 1 (Kp1;1 1 1;1 1
i +Kk;i 1 i 1 ) 1 1;2 2 1;2 2
i=1
k;i
p + 2 Kk;i i + Kk;i 1 i 1 i;i 1 ;
( k;i + k;i 1 )
2;2 p p
1
2 2 1 2;1 1 2;2 2
k = 1 + Kk;k k;k 1 k 2 Kk;k 1 k 1 k;k 1 Kk;k 1 k 1 k;k 1
and Pk
F^ ( ; $) = 1
2 i=1 wn;i i
+ wn;i 1 i 1 + wn;i i + wn;i 1 i 1 i;i 1 : (10)
As a result, we get the following algorithm for the numerical evaluation of the SR.
7 Numerical results
7.1 Comparison with Monte Carlo simulations
We compute the SR for various values of and , and as a result show the SR as a function of ( ; ). After
that one can choose ( ; ) in order to maximize the SR.
To be concrete, consider = 1:0 and = 0:49, T = 1:96. We compare our results with the Monte Carlo
method, which simulates
p the process and compute its expectation and variance (see [35]). First, we compare
separately E, = F E 2 , and G calculated by both methods in Figure 1:
8 Traditional approaches
8.1 Motivation
The method of heat potentials boils down to solving a system of Volterra equations of the second kind.
However, there are certain quantities of interest, which can be calculated directly. To put it into a proper
context, in this section we discuss several classical approached to the problem we are interested in. We
emphasize that the method of heat potentials is dramatically di¤erent from other method because it allows
one to consider strategies with …nite duration, say T , whilst, to the best of our knowledge, all other methods
are asymptotic in nature and assume that T ! 1.
10
We can use the Taylor series expansion for G (x) and represent it in the form
1
X
1 ( n2 ) n
G (x) = 4 (n+1) (2x) ; (16)
n=1
see also [38], where this formula is obtained via the Laplace transform. Taking into account boundary
conditions (14), we can represent g as follows:
(G( ) G( ))
g (1) (x; ; ) = 2 (I( ) I( )) (I (x ) I( )) (G (x ) G( )) : (17)
Given the fact that ! 0:5 corresponds to T ! 1, we can see from this Figure that for su¢ ciently remote
; the process stays within the range [ ; ] inde…nitely, or, at least, for a very long time.
Now we consider Eq. (12) and write
where
(2;1) (2;1)
( x) gx (x) + 12 gxx (x) = 2;
g (2;1) ( ) = 0; g (2;1) ( ) = 0;
(2;0) (2;0)
( x) gx (x) + 12 gxx (x) = g (2;1) (x) ;
(19)
g (2;0) ( ) = 0; g (2;0) ( ) = 0:
In is clear that
g (2;1) (x) = 2g (1) (x; ; ) ;
where g (1) is given by Eq. (17).
Green’s function G (x; y) for problem (19) has the form
8 2
< 2 e (y ) (I(y ) I( ))
(I (x ) I( )) y x ;
(I( ) I( ))
G (x; y) = )2
: 2e (y
(I(y ) I( ))
(I (x ) I( )) x y:
(I( ) I( ))
As usual, Ru
g (2;0) (x) = 2 1
G (x; y) g (1) (y; ; ) dy:
The explicit expression for the expected duration given by Eq. (18) is interesting in its own right and also
can be used for benchmarking solutions obtained via the method of heat potentials.
11
where is the digamma function and is the Euler-Mascheroni constant, = (1), see also [38], where
this formula is obtained via the Laplace transform.
In summary,
" (l ! u) E (T ) = 2 (G (u) G (l)) ;
# (u ! l) = # ( u ! l) = 4 G 2 ( l) 2J ( l) G 2 ( u) 2J ( u) :
Finally,
" (l ! u ! l) " (l ! u) + " (u ! l)
= 16 G (e) (u) G (o) (u) J (o) (u) G (e) (l) G (o) (l) J (o) (l)
since G, J are decomposed into the even and odd parts as follows:
G (x) = G (e) (x) + G (o) (x) ;
p p 1
G (e) (x) = N 2x 2 I (x) E (x) ;
p
G (o) (x) = 2 I (x) ;
12
Once the requisite quantities are computed, Bertram invokes classical results from renewal theory, [6, 7].1
The classical result from renewal theory, see, e.g., [39], gives the asymptotic properties of the random variable
M (t; l; u) representing the number of round trips on the time interval [0; t]:
t #(l!u!l)t
M (t; l; u) N "(l!u!l) ; "(l!u!l)3 ;
where N is the normal variable. Given that x represents the log-price of the underlying portfolio, the return
and asymptotic Sharpe ratio SR per unit of time are given by
(u l c)
r= "(l!u!l) ;
q
"(l!u!l) (u l c rf )
SR = #(l!u!l) (u l c) ;
where c, rf represent transaction fees, and risk-free rate, respectively. Bertram maximizes one of these
quantities over the stop-loss/take pro…t thresholds (l; u).
The main practical problem with this approach is that it assumes stationarity in perpetuity of the
underlying process, which is a somewhat questionable assumption. The other problem is that, even for a
stationary process, it takes a very long time for the strategy to reach its asymptotic state. The reason
why these issues have not been discussed earlier, is that it is very hard to calculate the probability density
function (pdf) for the processes l ! u, u ! l, and the round-trip process l ! u ! l. Recently, Lipton and
Kaushansky proposed a very e¢ cient method for calculating the pdfs for the processes l ! u, u ! l, see
[31, 32]; the the round-trip process l ! u ! l can be analyzed
p by p
convolution. We show the corresponding
pdfs for a representative choice of l, u, namely l = 1= 2, u = 1= 2 in Figure 7. This …gure clearly shows
that a very long right tail characterizes the round-trip process l ! u ! l, so that the strategy might never
reach its asymptotic limit in practice.
Figure 7 near here.
13
1 2 +2 3 2
a0 M 4 ; 2; u + a1 uM 4 ; 2; u = u;
+4 3 2 +2 3 2 ( +2) 2 +6 5 2
a0 uM 4 ; 2; u + a1 M 4 ; 2; u + 3 u M 4 ; 2; u = 1:
1 2 +2 3 2 (22)
c00 = M 4 ; 2; l ; c01 = lM 4 ; 2; l ;
1 2 +2 3 2
c10 = M 4 ; 2; u ; c11 = uM 4 ; 2; u ;
and obtain the following nonlinear algebraic equation for u:
+4 3 2
(c11 l c01 u) uM 4 ; 2; u
(23)
+2 3 2 ( +2) 2 +6 5 2
+ ( c10 l + c00 u) M 4 ; 2; u + 3 u M 4 ; 2; u = (c00 c11 c01 c10 ) :
a0 + a1 I (u) = u G (u) ;
2
a1 eu = 1 F (u) :
Accordingly,
I(u)(l G(l)) I(l)(u G(u))
a0 = (I(u) I(l)) ;
u G(u) (l G(l))
a1 = (I(u) I(l)) ;
2
eu (u G(u) (l G(l)))
(I(u) I(l)) =1 F (u) :
In Figure 9(a), we show V (x) x for l = 2:0 for several representative values of , the corresponding
optimal values of u are 1:07, 0:74, 0:50. In Figure 9(b) we show the optimal boundary u (l).
Figure 9 near here.
14
Z
x l Zx
z (x z)
I+ (x) = v (x z) e dz = v (z) e dz;
0 l
Z x
u Zu
z (z x)
I (x) = v (x + z) e dz = v (z) e dz;
0 x
0
I+ (x) v (x) + I+ (x) = 0;
In Figure 10(a), we show the solution vector (v (x) ; w (x) ; I+ (x) ; I (x)) corresponding to the suboptimal
choice of u. The shooting parameters, c; d, are chosen in such a way, that two of the three boundary conditions
(25) are satis…ed, v (u) = I (u) = 0. In Figure 10(b), we show what happens when the upper limit u is
chosen optimally, by using the Newton-Raphson method. For u = 1:18 all three conditions (25) are met.
In Figure 10(c), we demonstrate the quality of our numerical method by putting ! = 0 and comparing the
corresponding numerical solution with the analytical solution given by Eq. (15). The …gure shows that the
agreement is excellent.
Figure 10 near here.
15
g (q) = : (27)
Here represents transaction cost, while shows how far forward the behavior of the process can be
predicted. The trader should not change her position when q < x < q, and go maximally long when x = q,
and short when x = q.
While de Lataillade et al. use the path integral method to understand the behavior of Eqs (26,27), we
prefer to attack the problem in question directly - by solving the corresponding Fredholm equation. As
before, we solve Eq. (26) for a given q, and then adjust q by using the Newton-Raphson method until the
matching condition (27) is met. We notice in passing that K (x; y) is even, K ( x; y) = K (x; y), while
f (x) is odd, f ( x) = f (x), so that g (x) is even, g ( x) = g (x). Our analysis results in some unexpected
…ndings. Namely, Eqs (26,27) have multiple solutions. We choose = 0:1, = 1 and solve the equations
in question. It turns out that at least two critical values of q are possible, q = 0:0561 and q = 1:0131. We
show the corresponding solutions in Figures 12(a), (b). It can be shown that g (x), which has a single root at
x = 0 is the solution of interest. With this in mind, we can construct critical boundaries q ( ) corresponding
to several representative values of . These boundaries are shown in Figure 12(c).
9 Conclusions
In this paper we create an analytical framework for computing optimal stop-loss/take-pro…t bounds ( ; )
for O-U driven trading strategies by using the method of heat potentials.
First, we present a method for calibrating the corresponding O-U process to market prices. Second, we
derive an explicit expression for the SR given by Eq. (2), and maximize it with respect to the stop loss/ take
pro…t bounds ( ; ). Third, for three representative values of , we calculate the SR on a grid of ( ; ) and
pre-chosen times and graphically summarize in Figures 3, 4, 5. Next, for each case, we perform optimization
and present ( ; ) in Table 1. In agreement with intuition, in the case of strong misprising, it is optimal
to wait until the trade’s expiration without imposing stop losses/ take pro…t bounds. For weaker mispricing,
it is not optimal to stop losses, but it might be optimal to take pro…ts early. Still, to be on the safe side, we
recommend imposing stop losses chosen in accordance with one’s risk appetite to avoid unpleasant surprises
caused by the misspeci…cation of the underlying process.
Our rules help liquidity providers to decide how to o¤er liquidity to the market in the most pro…table
way, as well as by statistical arbitrage traders to optimally execute their trading strategies.
16
Acknowledgement 1 We greatly appreciate valuable discussions with Dr. Marsha Lipton, our partner at
Investimizer.
Acknowledgement 2 We are grateful to Dr. Vadim Kaushansky for his help with an earlier version of
this paper.
References
[1] Avellaneda, M. and Lee, J.-H., 2010. Statistical arbitrage in the us equities market. Quantitative Fi-
nance, 10(7):761-782.
[2] Bai, Y., Wu, L., 2018. Analytic value function for optimal regime-switching pairs trading rules. Quan-
titative Finance 18 (4), 637-654.
[3] Bailey D. H. and Lopez De Prado, M., 2013. The Sharpe Ratio E¢ cient Frontier. Journal of Risk, 15(2).
[4] Bailey D. H. and Lopez De Prado, M., 2014. The De‡ated Sharpe Ratio: Correcting for Selection Bias,
Backtest Over…tting and Non-Normality. Journal of Portfolio Management, 40(5):94-107.
[5] Baviera, R., Baldi, T. S., 2017. Stop-loss and leverage in optimal statistical arbitrage with an application
to energy market. Working paper, Politecnico di Milano.
[6] Bertram, W.K., 2009. Optimal trading strategies for Ito di¤usion processes. Physica A: Statistical
Mechanics and its Applications, 388(14): 2865-2873.
[7] Bertram, W.K., 2010. Analytic solutions for optimal statistical arbitrage trading. Physica A: Statistical
Mechanics and its Applications, 389(11): 2234-2243.
[8] Cummins, M., Bucca, A., 2012. Quantitative spread trading on crude oil and re…ned products markets.
Quantitative Finance 12 (12): 1857-1875.
[9] Do, B., Fa¤, R., 2012. Are pairs trading pro…ts robust to trading costs? Journal of Financial Research
35 (2), 261-287.
[10] Endres, S., Stübinger, J., 2017. Optimal trading strategies for Lévy-driven Ornstein-Uhlenbeck
processes. FAU Discussion Papers in Economics, No. 17/2017, Friedrich-Alexander-Universität
Erlangen-Nürnberg.
[11] Ekstrom, E., Lindberg, C., Tysk, J., 2011. Optimal liquidation of a pairs trade. In: Di Nunno, G.,
Oksendal, B. (Eds.), Advanced mathematical methods for …nance. Springer, Berlin, Heidelberg, pp.
247-255.
[12] Ekstrom, E., Lindberg, C., Tysk, J., Wanntorp, H., 2010. Optimal liquidation of a call spread. Journal
of Applied Probability 47, 586-593.
[13] Elliott, R. J., Van Der Hoek, J., and Malcolm, W. P. (2005). Pairs trading. Quantitative Finance,
5(3):271-276.
[14] Gatev, E., Goetzmann, W. N., Rouwenhorst, K. G., 2006. Pairs trading: Performance of a relative-value
arbitrage rule. Review of Financial Studies 19 (3), 797-827.
[15] Govender, K., 2011. Statistical arbitrage in South African …nancial markets. Working paper, University
of Cape Town.
[16] Goncu, A., Akyldirim, E., 2016. Statistical arbitrage with pairs trading. International Review of Finance
16 (2), 307-319.
17
[19] Hyer T., Lipton-Lifschitz, A., Pugachevsky D., 1997. Passport to success. Risk Magazine 10(9), 127-131.
[20] Kartashov, E., 2001. Analytical Methods in the Theory of Heat Conduction of Solids. Vysshaya Shkola,
Moscow 706.
[21] Krauss, C., 2015. Statistical arbitrage pairs trading strategies: Review and outlook, IWQW Discussion
Papers, No. 09/2015, Friedrich-Alexander-Universität Erlangen-Nürnberg.
[22] Lipton, A., 2002. Assets with jumps. Risk Magazine 15 (9), 149-153.
[23] Larsson, S., Lindberg, C., Warfheimer, M., 2013. Optimal closing of a pair trade with a model containing
jumps. Applications of Mathematics 58 (3), 249-268.
[24] de Lataillade, J., Deremble, C., Potters, M., Bouchaud, J-P. 2012. Optimal trading with linear costs.
Journal of Investment Strategies 1(3): 91-115.
[25] Leung, T., Li, X., 2015a. Optimal mean reversion trading: Mathematical analysis and practical appli-
cations. World Scienti…c, New Jersey, USA.
[26] Leung, T., Li, X., 2015b. Optimal mean reversion trading with transaction costs and stop-loss exit.
International Journal of Theoretical and Applied Finance 18 (3), 1550020.
[27] Li, X., 2015. Optimal multiple stopping approach to mean reversion trading. PhD thesis, Columbia
University.
[28] Liu, B., Chang, L.-B., Geman, H., 2017. Intraday pairs trading strategies on high frequency data: The
case of oil companies. Quantitative Finance 17 (1), 87-100.
[29] Lindberg, C., 2014. Pairs trading with opportunity cost. Journal of Applied Probability 51, 282-286.
[30] Lipton, A., 2001. Mathematical Methods for Foreign Exchange: A Financial Engineer’s Approach.
World Scienti…c, Singapore.
[31] Lipton, A. and Kaushansky, V., 2018. On the …rst hitting time density of an Ornstein-Uhlenbeck process.
arXiv preprint arXiv:1810.02390.
[32] Lipton, A. and Kaushansky, V., 2020. On the …rst hitting time density for a reducible di¤usion process.
Quantitative Finance, , DOI: 10.1080/14697688.2020.1713394.
[33] Lipton, A. and Kaushansky, V., 2020. Physics and Derivatives: On Three Important Problems in
Mathematical Finance. The Journal of Derivatives.
[34] Lipton, A., Kaushansky, V. and Reisinger, C., 2019. Semi-analytical solution of a McKean–Vlasov
equation with feedback through hitting a boundary. European Journal of Applied Mathematics, DOI:
10.1017/S0956792519000342.
[35] Lopez De Prado, M., 2018. Advances in …nancial machine learning. John Wiley & Sons, Hoboken, NJ,
USA.
[36] Lopez De Prado, M., 2019. Tactical Investment Algorithms. https://ssrn.com/abstract=3459866.
[37] Martin, R., Schöneborn, T., 2011. Mean reversion pays, but costs. Risk Magazine 24(2), 96-101.
[38] Ricciardi, L.M., Sato, S., 1988. First-passage-time density and moments of the Ornstein–Uhlenbeck
process. Journal of Applied Probability 25(1), 43–57.
18
[41] Suzuki, K., 2018. Optimal pair-trading strategy over long/short/square positionsjempirical study. Quan-
titative Finance 18 (1), 97-119.
[42] Tikhonov, A. N., Samarskii, A.A., 1963. Equations of Mathematical Physics. Dover Publications, New
York. English translation.
[43] Vidyamurthy, G., 2004. Pairs trading: Quantitative methods and analysis. John Wiley & Sons, Hoboken,
NY, USA.
[44] Watson, N.A., 2012. Introduction to Heat Potential Theory. Number 182 in Mathematical Surveys and
Monographs. American Mathematical Society, Providence, RI.
[45] Zeng, Z., Lee, C.-G., 2014. Pairs trading: Optimal thresholds and pro…tability. Quantitative Finance 14
(11), 1881-1893.
19
20
(c) (d)
(e) (f)
p
Figure 1: (a) E; = F E 2 and G as functions of 1 computed by using the method of heat potentials
and the Monte Carlo method for = 2; (b) Same quantities as functions of 0 computed using the
method of heat potentials and the Monte Carlo method for = 1; = 1:0, T = 1:96.
21
Figure 2: (a) The Sharpe ratio as a function of 1 computed by using the method of heat potentials
and the Monte Carlo method for = 1 (b) the Sharpe ratio as a function of 0 computed using the
method of heat potentials and the Monte Carlo method for = 1; = 1:0, T = 1:96.
22
(c) (d)
(e) (f)
Figure 3: The Sharpe Ratio as a function of ( ; ) for = 1:0 a)-b) T = 1:96, c)-d) T = 4:26, e)-f) T = 6:56.
23
(c) (d)
(e) (f)
Figure 4: The Sharpe Ratio as a function of ( ; ) for = 0:5 a)-b) T = 1:96, c)-d) T = 4:26, e)-f) T = 6:56.
24
(c) (d)
(e) (f)
Figure 5: The Sharpe Ratio as a function of ( ; ) for = 0:0 a)-b) T = 1:96, c)-d) T = 4:26, e)-f) T = 6:56.
25
(c) (d)
Figure 6: In Figures (a)-(b) we show the expected duration = (1 exp ( 2G) =2) as a function of , ; in
Figures (c)-(d) we show the logarithm of the expected duration G. The corresponding = 1:0. Here and in
Figures 3, 4, 5 0 , 1 .
26
(b)
27
(b)
Figure 8: Figure (a) shows the nondimensional value function V (x) x for several representative values of
, the corresponding optimal values of u are 1:15, 0:97, 0:87; Figure (b) shows the nondimensional optimal
take-pro…t boundary u as a function of the nondimensional stop-loss boundary l.
28
(b)
Figure 9: Figure (a) shows the nondimensional value function V (x) x for l = 2:0, and several rep-
resentative values of , the corresponding optimal values of u are 1:07, 0:74, 0:50; Figure (b) shows the
nondimensional optimal execution boundary u (l).
29
(b)
(c)
Figure 10: Figure (a) shows the nondimensional value functions v (x) for l = 2:0, = 0:1, ! = 0:1, = 1:0.
We choose u = 1, which is not optimal. Hence, the matching condition is not satis…ed. Figure (b) shows the
value function v (x) for the optimal value of u = 1:18. Since u is optimal, the matching condition is met, so
that w (u) = 0. Figure (c) shows the nondimensional value functions v (x) for l = 2:0, u = 1:18, = 0:1,
! = 0:0, = 1:0.
30
(b)
Figure 11: Figure (a) shows the nondimensional value functions v (x) for l = 2:0, and several representative
values of , the corresponding optimal values of u are 1:18, 0:81Figure (b) shows the nondimensional optimal
execution boundary u (l). Here ! = 0:1, = 1:0.
31
(b)
(c)
Figure 12: In Figure (a) we show g (x) corresponding to the critical value q = 0:0561; in Figure (b) we show
g (x) corresponding to the critical value q = 1:0131. We can see that in the …st case g (x) has a single root
at x = 0, while in the second case, there are three roots. In Figure (c) we show critical boundaries q ( )
corresponding to three representative values of , = 0:05, 0:10, 0:20. It is clear that for larger values of ,
it is bene…cial to wait longer before changing one’s position.
32