0% found this document useful (0 votes)
54 views32 pages

A Closed-Form Solution For Optimal Mean-Reverting Trading Strategies

1. The document discusses analytical frameworks for deriving optimal trading rules for mean-reverting trading strategies that maximize Sharpe ratio. These optimal rules provide profit-taking and stop-loss levels. 2. The author develops such analytical solutions using the method of heat potentials, which has been applied in physics but not widely in finance. This allows traders to deploy optimal algorithms tailored to prevailing market conditions. 3. Key variables in the model include the position size, entry and mark-to-market prices over time, and profit/loss at each opportunity. Parameters like the mean-reversion speed and random shocks are estimated from historical data.

Uploaded by

Edwin Diaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views32 pages

A Closed-Form Solution For Optimal Mean-Reverting Trading Strategies

1. The document discusses analytical frameworks for deriving optimal trading rules for mean-reverting trading strategies that maximize Sharpe ratio. These optimal rules provide profit-taking and stop-loss levels. 2. The author develops such analytical solutions using the method of heat potentials, which has been applied in physics but not widely in finance. This allows traders to deploy optimal algorithms tailored to prevailing market conditions. 3. Key variables in the model include the position size, entry and mark-to-market prices over time, and profit/loss at each opportunity. Parameters like the mean-reversion speed and random shocks are estimated from historical data.

Uploaded by

Edwin Diaz
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 32

A closed-form solution for optimal mean-reverting trading

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]

Electronic copy available at: https://ssrn.com/abstract=3534445


When prices re‡ect all available information, they oscillate around an equilibrium level. This oscillation
is the result of the temporary market impact caused by waves of buyers and sellers. The resulting price
behavior can be approximated through an O-U process. The parameters of the process might be estimated
using historical data.
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
occurs: (A) they achieve a targeted pro…t; (B) they experience a maximum tolerated loss; (C) the position
is held beyond a maximum tolerated horizon.
All traders 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.
Lopez de Prado (Chapter 13) explains how to identify those optimal levels in the sense of maximizing the
trader’s Sharpe ratio (SR) in the context of O-U processes via Monte Carlo experiments, [35]. Although
Lopez de Prado (p. 192) conjectured the existence of an analytical solution to this problem, he identi…ed it as
an open problem. In this paper, we solve the critical question of …nding optimal trading rules analytically by
using the method of heat potentials. These optimal pro…t-taking/stop-loss trading rules for mean-reverting
trading strategies provide the algorithm that must be followed to exit a position. To put it di¤erently, we
…nd the optimal exit corridor to maximize the SR of the strategy.
The method of heat potential is a highly powerful and versatile approach popular in mathematical physics;
see, e.g., [42, 40, 20, 44] among others. It has been successfully used in numerous important …elds, such as
thermal engineering, nuclear engineering, and material science. However, it is not particularly popular in
mathematical …nance,even though the …rst important use case was given by Lipton almost twenty years ago.
Speci…cally, Lipton considered pricing barrier options with curvilinear barriers, see [30], Section 12.2.3, pp.
462–467. More recently, Lipton and Kaushansky described several important …nancial applications of the
method, see [31, 34, 32, 33].
The SR is de…ned as the ratio between the expected returns of an execution algorithm and the standard
deviation of the same returns. The returns are computed as the logarithmic ratio between the exit and
entry prices, times the sign of the order side ( 1 for a sell order, +1 for a buy order). Our choice of the
SR as an objective function is due to two reasons: (A) The SR is the most popular criterion for investment
e¢ ciency, [3]; (B) The SR can be understood as a t-value of the estimated gains, and modelled accordingly
for inferential purposes. The distributional properties of the SR are well-known, and this statistic can be
de‡ated when the assumption of normality is violated, [4].
Having an analytical estimation of the optimal pro…t-taking and stop-out levels allows traders to deploy
tactical execution algorithms, with maximal expected SR. Rather than deriving an “all-weather” execution
algorithm, which supposedly works under every market regime, traders can use our analytical solution for
deploying the algorithm that maximizes the SR under the prevailing market regime, [36].

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:

i;Ti , where > 0 is the pro…t-taking threshold.

i;Ti , where < 0 is the stop-loss threshold.


Because < , one and only one of the two exit conditions can trigger the exit from opportunity
i. Assuming that opportunity i can be exited at Ti , its …nal pro…t/loss is i;Ti . At the onset of each

Electronic copy available at: https://ssrn.com/abstract=3534445


opportunity, the goal is to realize an expected pro…t

E0 [ i;Ti ] = mi (E0 [Pi;Ti ] Pi;0 );

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:

Pi;t E0 [Pi;Ti ] = (E0 [Pi;Ti ] Pi;t 1) + "i;t ;

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.

4 Explicit problem formulation


In this rather technical section, we perform transformations in order to formulate the problem in terms of
heat potentials.
Consider a long investment strategy S and suppose pro…t/loss opportunity is driven by an O-U process
(see [35] among many others):
0
dx0 = 0
x0 dt0 + 0
dWt0 ; x0 (0) = 0; (1)

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

Electronic copy available at: https://ssrn.com/abstract=3534445


when the price hits . Given the fact that the re‡ection x ! x leaves the initial condition unchanged and
transforms the original O-U process into the O-U process of the form
dx = ( x) dt + dWt ; x (0) = 0;
we can restrict ourselves to the case 0. More explicitly and intuitively, we go long when 0 and short
when < 0. Assuming that we know the trading rule f ( ; T ) ; ( ; T ) ; T g for 0, the corresponding
trading rule for < 0 has the form
f ( ;T); ( ;T);Tg = f ( ;T); ( ; T ) ; T g:
Thus, we are interested in the maximization of the SR for nonnegative 0. We formulate this mathemat-
ically below.
For a given T , we de…ne the stopping time = infft : xt = or xt = or t = T g. We wish to determine
optimal > 0; < 0,to maximize the SR,
Efx = g
SR = p ;
Efx2 = 2 g (Efx = g)2

We also need to know the expected duration of the trade,


DUR = E f g :
In order to calculate the corresponding SR and DUR we proceed as follows. We solve three terminal
boundary value problems (TBVPs) of the form
Et (t; x) + ( x) Ex (t; x) + 12 Exx (t; x) = 0;

E (t; ) = t ; E (t; ) = t ;

x
E (T; x) = T;

Ft (t; x) + ( x) Fx (t; x) + 21 Fxx (t; x) = 0;


2 2
F (t; ) = t2 ; F (t; ) = t2 ;

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;

Electronic copy available at: https://ssrn.com/abstract=3534445


F ( ; x) = ( x) Fx ( ; x) + 21 Fxx ( ; x) ;
2 2
F( ; )= (T )2
; F( ; )= (T )2
;

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

Electronic copy available at: https://ssrn.com/abstract=3534445


where
^ ( ; ) = 1E
E ^ ( ; );
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.

5 The method of heat potentials


^ We have
Now we are ready to use the classical method of heat potentials to calculate the SR. Consider E.
to solve the following coupled system of Volterra integral equations:
Z ( ( ) ( ))2
( ( ) ( ))e 2( )
"( ) + p1 "( )d
2 ( )3=2
0
(3)
Z ( ( ) ( ))2
( ( ) ( ))e 2( )
+ p12 ( )3=2
"( )d = e( );
0

Z ( ( ) ( ))2

p1
( ( ) ( ))e 2( )
"( ) + 2 ( )3=2
"( )d
0
(4)
Z ( ( ) ( ))2
( ( ) ( ))e 2( )
+ p12 ( )3=2
"( )d = e( );
0

Electronic copy available at: https://ssrn.com/abstract=3534445


^ ( ; ) can be written as follows:
Once these equations are solved, E
Z ( ( ))2 Z ( ( ))2

^( ; )= p1
( ( ))e 2( )
p1
( ( ))e 2( )
E 2 ( )3=2
"( )d + 2 ( )3=2
"( )d : (5)
0 0

We can …nd F^ ( ; ) by the same token:


Z ( ( ) ( ))2
( ( ) ( ))e 2( )
( )+ p1 ( )d
2 ( )3=2
0
(6)
Z ( ( ) ( ))2
( ( ) ( ))e 2( )
+ p12 ( )3=2
( )d = f ( );
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
( );

Electronic copy available at: https://ssrn.com/abstract=3534445


1 2
with respect to variables ( ( ); ( )), where
( ) (s) ( ( ) (s))2
K 1;1 ( ; s) = p1 exp ;
2 s 2( s)

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

Pk 1 1 2;1 1 2;1 1 (Kp2;2 2 2;2 2


i +Kk;i 1 i 1 )
i=1 2 Kk;i i + Kk;i 1 i 1 + k;i
p i;i 1 :
( k;i + k;i 1 )
The approximation error of the integrals is of order O( 2 ), where = maxi i;i 1 ). Hence, on uniform
grid, the convergence is of order O( ). We emphasize that, due to the nature of (e( ); e( )), etc., it is
necessary to use a highly inhomogeneous grid which is concentrated near the right endpoint.

Electronic copy available at: https://ssrn.com/abstract=3534445


6.1 Computation of the Sharpe ratio
Once ("( ); "( )) and ( ); ( ) are computed, we can approximate E( ^ ; ) and F^ ( ; ). We interested to
compute these functions at one point ( ; $), which can be done by approximation of the integrals using the
trapezoidal rule:
^ ; $) = 1
Pk
E( 2 i=1 wn;i "i + wn;i 1 "i 1 + wn;i "i + wn;i 1 "i 1 i;i 1 ; (9)

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)

The corresponding weights are as follows:


2 2
($ i) ($ i)
2 2
($ i )e n;i ($ i )e n;i
wn;i = p 3=2 ; wn;i = p 3=2 1 i < n;
2 n;i 2 n;i
wn;i = 0 wn;i = 0; i = n:

As a result, we get the following algorithm for the numerical evaluation of the SR.

Algorithm 1 Numerical evaluation of the Sharpe ratio


Step 1 De…ne a time grid 0 = 0 < 1 < : : : < .
Step 2 Compute ( ); ( ); ( ); ( ) using numerical method in Section 6.
Step 3 Compute E( ^ ; $) by using (9).
Step 4 Compute F^ ( ; $) by using Eq. (10).
Step 5 Compute the Sharpe ratio by using Eq. (2).

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:

Figure 1 near here.

Second, we show the results for the SR itself in Figure 2:

Figure 2 near here.


We see that the relative di¤erence between the method of heat potentials and the Monte Carlo method is
small and mainly comes from the Monte Carlo noise.

7.2 Optimization of the Sharpe ratio


In this section we solve a problem of …nding parameters to maximize the SR by analyzing it as a function of
( ; ) for di¤erent values of and . Two problems are considered: (A) Fix and maximize the SR over
( ; ); (B) Maximize the SR over ( ; ; p ).
Given that the natural unit = 1= 2, we consider three representative values of , namely = 1,
= 0:5, and = 0, corresponding to strong and weak mispricing and fair pricing, respectively. We choose
three maturities, = 0:49, 0:4999, 0:499999 or ,equivalently, T = 1:96, 4:26, 6:56. For negative , the
corresponding SR can be obtained by re‡ection if needed.

Electronic copy available at: https://ssrn.com/abstract=3534445


We show the corresponding SR surfaces in Figures 3, 4, 5:
Figure 3 near here.
Figure 4 near here.
Figure 5 near here.
The optimal bounds ( ; ) are given in the Table 1 below:

Table 1 near here.


This table shows that in the case when the original mispricing is strong ( = 1) it is not optimal to stop the
trade early. When the mispricing is weaker ( = 0:5) or there is no mispricing in the …rst place ( = 0) it
is not optimal to stop losses, but it might be bene…cial to take pro…ts. We emphasize that in practice one
needs to use a highly reliable estimation of the O-U parameters to be able to use these rules with con…dence.

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.

8.2 Expectation and variance of the trade’s duration


In this subsection, we calculate the expected value and the variance of the of duration of a trade, which
terminates only when the spread hits one of the barriers, T = 1 (or = 0:5). Speci…cally, we show how
to calculate these quantities analytically by solving inhomogeneous linear ordinary di¤erential equations
(ODEs).
In the case in question, the second change of variables is not necessary, so that we can concentrate on
the following problems:
(1) (1) (1)
Gt (t; x) + ( x) Gx (t; x) + 21 Gxx (t; x) = 0;
(11)
G(2) (t; ) = t; G(1) (t; ) = t;
(2) (2) (2)
Gt (t; x) + ( x) Gx (t; x) + 21 Gxx (t; x) = 0;
(12)
G(2) (t; ) = t2 ; G(2) (t; ) = t2 :
with implicit terminal conditions at T ! 1. The superscripts indicate the …rst and second moments,
respectively.
We start with the expectation. We can represent the solution G(1) (t; x) of Eq. (11) in a semi-stationary
form:
G(1) (t; x) = t + g (1) (x) ;
where
(1) (1)
( x) gx (x) + 21 gxx (x) = 1; (13)
g (1) ( ) = 0; g (1) ( ) = 0: (14)
Eq. (13) can be solved by the method of variation of constants:
(1) )2
gx (x) = a1 e(x + F (x );
(15)
g (1) (x) = a0 + a1 I (x ) + G (x );

10

Electronic copy available at: https://ssrn.com/abstract=3534445


where a0 , a1 are arbitrary constants. Here D (x) is Dawson’s function, E (x) is its integral, and F (x) ; G (x)
are convenient abbreviations:
Rx 2 2 Rx 2 2
I (x) = 0 ez dz; D (x) = e x 0 ez dz = e x I (x) ;
Rx p p 2
E (x) = 0
D (z) dz; F (x) = N 2x ex ;
p p
G (x) = N 2x I (x) E (x) :

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)

Finally, the expected duration is given by the following expression:

DUR = g (0) : (18)

We show the expected duration as a function of ; for = 1 in Figure 6:

Figure 6 near here.

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

G(2) (t; x) = t2 + tg (2;1) (x) + g (2;0) (x) ;

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

Electronic copy available at: https://ssrn.com/abstract=3534445


8.3 Renewal theory approach
To facilitate the comparison with previously know results, from now on, we assume that = 0.
In this subsection, we revisit Bertram’s approach [6, 7]. In a nutshell, Bertram assumes that the un-
derlying O-U process, representing portfolio’s log-price, is running in perpetuity. He envisions the following
investment strategy. When the return process x hits the lower level l, the underlying is bought. When
the process x hits the upper level u, the underlying is sold. Thus, the round trip is characterized by two
transitions, x = l ! x = u, and x = u ! x = l; once the round trip is completed, the process starts again.
We can use the same ideas as in Section 8.2 to calculate E (T ),E T 2 , and V (T ) for the hitting time of
a given level u, starting at the level x = l by letting ! 1; = u:
E (T ) = 2 (G (u) G (l)) ;

E T 2 = 8 (G (u) (G (u) G (l)) (J (u) J (l))) ;

V (T ) = 4 G 2 (u) 2J (u) G 2 (l) 2J (l) ;


where Rx y2
J (x) = 1
e (I (x) I (y)) G (y) dy
Rx y2
Rx
= I (x) 1
e G (y) dy 1
D (y) G (y) dy:
Similarly to Eq. (16), we can write:
1
X
1 ( n2 )( ( n2 )+ ) n
J (x) = 16 (n+1) (2x) ;
n=1

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

# (l ! u) V (T ) = 4 G 2 (u) 2J (u) G 2 (l) 2J (l) :


By symmetry,
" (u ! l) = " ( u ! l) = 2 (G ( l) G ( u)) ;

# (u ! l) = # ( u ! l) = 4 G 2 ( l) 2J ( l) G 2 ( u) 2J ( u) :
Finally,
" (l ! u ! l) " (l ! u) + " (u ! l)

= 2 (G (u) G ( u) (G (l) G ( l)))


p
=2 (I (u) I (l)) ;
# (l ! u ! l) # (l ! u) + # (u ! l)

=4 G 2 (u) G 2 ( u) 2 (J (u) J ( u)) G 2 (l) G 2 ( l) 2 (J (l) J ( 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

Electronic copy available at: https://ssrn.com/abstract=3534445


J (x) = J (e) (x) + J (o) (x) ;
Rx y2
R0 Rx
J (e) (x) = I (x) 0
e G (e) (y) dy 1
D (y) G (y) dy 0
D (y) G (e) (y) dy
R0 y2
p p Rx
J (o) (x) = I (x) 1
e G (y) dy + 2 E (x) 2 0
D (y) I (y) dy:

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.

8.4 Perpetual value function


In this section, we discuss results obtained in [12, 11, 23, 29], and rederive and improve their …ndings in a
concise semi-analytic fashion.
The stationary problem for determining the value function and the optimal take-pro…t level u for a given
stop-loss level l (which is determined by the investor’s risk appetite) and the time value of money has the
form:
Vxx (x) 2xVx (x) V = 0; l x u;
(20)
V (l) = l; V (u) = u; V 0 (u) = 1:
This problem is similar, but by no means identical, to the pricing problem for the perpetual American call
option on a dividend-paying stock. Here is the non-dimensional discount rate, = 2r= .
The second-order ordinary di¤erential equation (20) is the well-known Hermite di¤erential equation. Its
general solution has the form
1 2 +2 3 2
V (x) = a0 M 4 ; 2; x + a1 xM 4 ; 2; x ; (21)
1 Wenote in passing that Bertram uses informal notation, which is dimensionally incorrect, such as V (1=T ) = V (T ) =E (T )3 ,
and next to impossible to understand, although his …nal results are correct.

13

Electronic copy available at: https://ssrn.com/abstract=3534445


where M (a; b; z) is the celebrated Kummer function (a con‡uent hypergeometric function of the …rst kind),
and a0 ; a1 are arbitrary constants. Boundary conditions (20) yield:
1 2 +2 3 2
a0 M 4 ; 2; l + a1 lM 4 ; 2; l = l;

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:

Here we use the fact that


Mz (a; b; z) = ab M (a + 1; b + 1; z) :
We eliminate a0 ; a1 :
c11 l c01 u c10 l+c00 u
a0 = c00 c11 c01 c10 ; a1 = c00 c11 c01 c10 ;

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

We solve Eq. (23) via the Newton-Raphson method.


Once u is found, we use Eqs (21), (22), to construct the value functions V (x). We show V (x) x and
u (l) for several representative values of in Figures 8 (a), (b).
Figure 8 near here.
The stationary problem for determining the value function and the optimal take-pro…t level U for a given
stop-loss level L (which is determined by the investor’s risk appetite) and the opportunity cost c has the
nondimensional form:
Vxx (x) 2xVx (x) = ; l x u;
(24)
V (l) = l; V (u) = u; Vx (u) = 1;
where is the non-dimensional opportunity cost, = 2c= . It is easy to show that the general solution of
Eq. (24) has the form given by Eq. (15). As before we get the following set of equations:
a0 + a1 I (l) = l G (l) ;

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

Electronic copy available at: https://ssrn.com/abstract=3534445


It is natural to ask what happens when the underlying mean-reverting process has a jump component,
so that
dx = xdt + dWt + JdPt ;
where Pt is a Poisson process with intensity , and J is the jump magnitude, which is assumed to be a
random variable with density function (J), see [23]. Larsson et al. use the …nite element method to
solve the corresponding free boundary problem. However, if J has a double exponential distribution density
function (J),
(J) = e jJj ;
or, more generally, a hyper-exponential distribution, see, e.g., [22], the problem can be solved in a semi-
analytical fashion.
To this end, it is convenient to write the problem with jumps in terms of v (x) = V (x) x:

v 00 (x) 2xv 0 (x) + ! (I+ (x) + I (x) v (x)) = + (2 + !) x;

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

v (l) = v (u) = v 0 (u) = I+ (l) = I (u) = 0;


where ! = . It can be written as an inhomogeneous system of linear ODEs:
v 0 (x) w (x) = 0

w0 (x) 2xw (x) + ! (I+ (x) + I (x) v (x)) = + (2 + !) x;

0
I+ (x) v (x) + I+ (x) = 0;

I (x) + v (x) I (x) = 0;

v (l) = 0; w (l) = c; I+ (l) = 0; I (l) = d:


This system can be solved by the method of shooting by choosing initial values c; d and the right endpoint
of the computational interval b to satisfy the remaining boundary conditions

v (u) = w (u) = I (u) = 0: (25)

or in the matrix form:


0 10 0 10 1 0 1
v 0 1 0 0 v 0
B w C B ! C B C B + (2 + !) x C
B C +B ! 2x ! CB w C=B C:
@ I+ A @ 1 0 0 A @ I+ A @ 0 A
I 1 0 0 I 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

Electronic copy available at: https://ssrn.com/abstract=3534445


In Figure 11(a), we show v (x) for l = 2:0, the corresponding optimal values of u are 1:18, 0:80, 0:55;
we show u (l) for several representative values of in Figure 11(b), while

Figure 11 near here.

8.5 Linear transaction costs


Several researchers, including de Lataillade et al., [24], concentrated on the critical question on how linear
transaction costs a¤ect the pro…tability of mean-reverting trading strategies. An alternative treatment is
given by [37], see also [9]. Denuded of all amenities, the approach of de Lataillade et al. is almost identical
to the method used by Hyer et al., [19], for studying passport options.
de Lataillade et al. reduce the problem to solving the following Fredholm integral equation of the second
kind Rq
g (x) q
K (x; y) g (y) dy = f (x) ; (26)
where
( y x)2
exp 2 1)
(
K (x; y) = p 2
;
( 1)
p p
f (x) = x + N p2( q x)
2
N p2( q+x)
2
;
( 1) ( 1)

where = e . Eq. (26) is augmented with the matching condition

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

Figure 12 near here.

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

Electronic copy available at: https://ssrn.com/abstract=3534445


A very interesting and di¢ cult multi-dimensional version of these rules (covering several correlated stocks)
will be described elsewhere.

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

Electronic copy available at: https://ssrn.com/abstract=3534445


[17] Gregory, I., Ewald, C.-O., Knox, P., 2011. Analytical pairs trading under di¤erent assumptions on the
spread and ratio dynamics. Working paper, University of Sydney.
[18] Huck, N., Afawubo, K., 2015. Pairs trading and selection methods: Is cointegration superior? Applied
Economics 47 (6), 599-613.

[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

Electronic copy available at: https://ssrn.com/abstract=3534445


[39] Ross, S.M., 2010. Introduction to Probability Models. Tenth Edition. Academic Press, San Diego, CA,
USA
[40] Rubinstein, L. 1971. The Stefan Problem. Vol. 27 of Translations of Mathematical Monographs. Amer-
ican Mathematical Society, Providence, RI.

[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

Electronic copy available at: https://ssrn.com/abstract=3534445


n ;T 0:49; 0:8 0:4999; 1:96 0:499999; 4:26
= 4:0 = 4:0 = 4:0
1:0 = 4:0 = 4:0 = 4:0
SR = 1:2261 SR = 1:3824 SR = 1:3709
= 4:0 = 4:0 = 4:0
0:5 = 0:6 = 0:9 = 1:0
SR = 0:8219 SR = 0:8792 SR = 0:8963
= 4:0 = 4:0 = 4:0
0:0 = 0:1 = 0:4 = 0:1
SR = 0:7075 SR = 0:7139 SR = 0:7411

Table 1: The Sharpe Ratio maximized over ( ; ) for …xed or T .

20

Electronic copy available at: https://ssrn.com/abstract=3534445


(a) (b)

(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

Electronic copy available at: https://ssrn.com/abstract=3534445


(a) (b)

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

Electronic copy available at: https://ssrn.com/abstract=3534445


(a) (b)

(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

Electronic copy available at: https://ssrn.com/abstract=3534445


(a) (b)

(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

Electronic copy available at: https://ssrn.com/abstract=3534445


(a) (b)

(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

Electronic copy available at: https://ssrn.com/abstract=3534445


(a) (b)

(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

Electronic copy available at: https://ssrn.com/abstract=3534445


(a)

(b)

Figure 7: Figure (a) shows the pdf for the


p process lp! u; Figure (b) shows the pdf for the round-trip process
l ! u ! l. The corresponding l = 1= p2, u = 1= 2. We make this choice because one standard deviation
of the stationary O-U distribution is 1= 2.

27

Electronic copy available at: https://ssrn.com/abstract=3534445


(a)

(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

Electronic copy available at: https://ssrn.com/abstract=3534445


(a)

(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

Electronic copy available at: https://ssrn.com/abstract=3534445


(a)

(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

Electronic copy available at: https://ssrn.com/abstract=3534445


(a)

(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

Electronic copy available at: https://ssrn.com/abstract=3534445


(a)

(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

Electronic copy available at: https://ssrn.com/abstract=3534445

You might also like