Markets: A Rigorous Course

13A.8 Trading bands under OU

Advanced about 25 min

Motivation

Where should you enter and exit? Practitioners use "enter at two standard deviations, exit at the mean". Under an OU model the question has an exact answer, and the answer is far from two standard deviations.

13A.8.1The strategy and the renewal argument#

Centre the spread so that θ=0\theta = 0. Fix levels a<ma < m and a round-trip cost cc (in spread units). The cycle strategy (Bertram 2010): when XX hits aa, buy one unit of the spread; when it then hits mm, sell; wait until XX returns to aa; repeat. With continuous monitoring, each completed trade earns exactly m−a−cm - a - c. The OU process is positive recurrent, so every trade eventually closes, and by the strong Markov property the cycle lengths T1,T2,…\mathcal T_1, \mathcal T_2,\dots are i.i.d. By the renewal–reward theorem the long-run profit per unit time is

μ(a,m)=m−a−cE[T],E[T]=Ea[τm]+Em[τa],(13A.26)\mu(a,m) = \frac{m - a - c}{\mathbb E[\mathcal T]},\qquad \mathbb E[\mathcal T] = \mathbb E_a[\tau_m] + \mathbb E_m[\tau_a], \tag{13A.26}

where τℓ\tau_\ell is the first time the process hits ℓ\ell. A symmetric long–short version that also sells the spread at mm and buys it back at aa earns 2(m−a−c)2(m-a-c) per cycle and has the same optimal levels.

13A.8.2Expected first-passage times#

Proposition 13A.9mean first-passage time of OU

For x<ℓx<\ell, with z=(x−θ)κ/σz = (x-\theta)\sqrt\kappa/\sigma and zℓ=(ℓ−θ)κ/σz_\ell = (\ell-\theta)\sqrt\kappa/\sigma,

Ex[τℓ]=πκ∫zzℓerfcx⁡(−u) du=2σ2∫xℓeκ(v−θ)2/σ2∫−∞ve−κ(w−θ)2/σ2 dw dv,(13A.27)\mathbb E_x[\tau_\ell] = \frac{\sqrt\pi}{\kappa}\int_{z}^{z_\ell}\operatorname{erfcx}(-u)\,du = \frac{2}{\sigma^2}\int_x^\ell e^{\kappa(v-\theta)^2/\sigma^2}\int_{-\infty}^{v}e^{-\kappa(w-\theta)^2/\sigma^2}\,dw\,dv, \tag{13A.27}

where erfcx⁡(u)=eu2erfc⁡(u)\operatorname{erfcx}(u) = e^{u^2}\operatorname{erfc}(u). For x>ℓx>\ell, by the reflection x−θ↦θ−xx-\theta\mapsto\theta-x, replace erfcx⁡(−u)\operatorname{erfcx}(-u) by erfcx⁡(u)\operatorname{erfcx}(u) and integrate from zℓz_\ell to zz.

Proof

Take θ=0\theta = 0. Let T(x)=Ex[τℓ]T(x) = \mathbb E_x[\tau_\ell] for x<ℓx<\ell. The generator of (13A.22) is L=−κx ∂x+σ22∂xx\mathcal L = -\kappa x\,\partial_x + \tfrac{\sigma^2}{2}\partial_{xx}. By Dynkin's formula, TT solves

σ22T′′(x)−κx T′(x)=−1,T(ℓ)=0,\tfrac{\sigma^2}{2}T''(x) - \kappa x\,T'(x) = -1,\qquad T(\ell) = 0,

with TT growing no faster than polynomially as x→−∞x\to-\infty (the boundary at −∞-\infty is natural). Multiply by the integrating factor 2σ2e−κx2/σ2\tfrac{2}{\sigma^2}e^{-\kappa x^2/\sigma^2}: (e−κx2/σ2T′(x))′=−2σ2e−κx2/σ2\big(e^{-\kappa x^2/\sigma^2}T'(x)\big)' = -\tfrac{2}{\sigma^2}e^{-\kappa x^2/\sigma^2}. Integrate from −∞-\infty (where e−κx2/σ2T′(x)→0e^{-\kappa x^2/\sigma^2}T'(x)\to0 under the growth condition):

T′(x)=−2σ2eκx2/σ2∫−∞xe−κw2/σ2dw.T'(x) = -\frac{2}{\sigma^2}e^{\kappa x^2/\sigma^2}\int_{-\infty}^x e^{-\kappa w^2/\sigma^2}dw.

Integrate from xx to ℓ\ell using T(ℓ)=0T(\ell)=0; this gives the double integral in (13A.27). Substitute w=σu′/κw = \sigma u'/\sqrt\kappa: ∫−∞ve−κw2/σ2dw=σκπ2erfc⁡(−u)\int_{-\infty}^v e^{-\kappa w^2/\sigma^2}dw = \frac{\sigma}{\sqrt\kappa}\frac{\sqrt\pi}{2}\operatorname{erfc}(-u) with u=vκ/σu = v\sqrt\kappa/\sigma, and dv=σ du/κdv = \sigma\,du/\sqrt\kappa. The constants combine to 2σ2⋅σ2κ⋅π2=πκ\frac{2}{\sigma^2}\cdot\frac{\sigma^2}{\kappa}\cdot\frac{\sqrt\pi}{2} = \frac{\sqrt\pi}{\kappa}, and eu2erfc⁡(−u)=erfcx⁡(−u)e^{u^2}\operatorname{erfc}(-u) = \operatorname{erfcx}(-u).∎

The scaled complementary error function erfcx⁡\operatorname{erfcx} is used because eu2e^{u^2} and erfc⁡\operatorname{erfc} separately overflow and underflow for moderate uu; scipy.special.erfcx is stable.

Corollary 13A.10Bertram's cycle time

For a<ma<m,

E[T]=πκ[erfi⁡((m−θ)κσ)−erfi⁡((a−θ)κσ)],(13A.28)\mathbb E[\mathcal T] = \frac{\pi}{\kappa}\Big[\operatorname{erfi}\Big(\frac{(m-\theta)\sqrt\kappa}{\sigma}\Big) - \operatorname{erfi}\Big(\frac{(a-\theta)\sqrt\kappa}{\sigma}\Big)\Big], \tag{13A.28}

where erfi⁡(u)=2π∫0ues2ds\operatorname{erfi}(u) = \frac{2}{\sqrt\pi}\int_0^u e^{s^2}ds.

Proof

Add the two passage times from (13A.27). In uu-units, erfcx⁡(−u)+erfcx⁡(u)=eu2[erfc⁡(−u)+erfc⁡(u)]=2eu2\operatorname{erfcx}(-u) + \operatorname{erfcx}(u) = e^{u^2}[\operatorname{erfc}(-u) + \operatorname{erfc}(u)] = 2e^{u^2}. So E[T]=πκ∫zazm2eu2du=πκπ [erfi⁡(zm)−erfi⁡(za)]\mathbb E[\mathcal T] = \frac{\sqrt\pi}{\kappa}\int_{z_a}^{z_m}2e^{u^2}du = \frac{\sqrt\pi}{\kappa}\sqrt\pi\,[\operatorname{erfi}(z_m)-\operatorname{erfi}(z_a)].∎

The inner integrals over (−∞,v)(-\infty, v) and (v,∞)(v,\infty) add to a constant, which is why the round trip has a closed form and each leg separately does not.

13A.8.3Optimal bands#

Proposition 13A.11optimal bands for expected profit per unit time

(a) Any interior maximiser of μ(a,m)\mu(a,m) in (13A.26) is symmetric about θ\theta: a=θ−da = \theta - d, m=θ+dm = \theta + d. (b) With u=dκ/σu = d\sqrt\kappa/\sigma and c^=cκ/σ\hat c = c\sqrt\kappa/\sigma, the optimal u∗u^* is the unique root in (c^/2,∞)(\hat c/2,\infty) of

(2u−c^) eu2=π erfi⁡(u).(13A.29)(2u - \hat c)\,e^{u^2} = \sqrt\pi\,\operatorname{erfi}(u). \tag{13A.29}

(c) For small c^\hat c, u∗≈(3c^/4)1/3u^*\approx(3\hat c/4)^{1/3}: the band width grows like the cube root of the cost. (d) As c→0c\to0, the maximal rate tends to σκ/(2π)\sigma\sqrt\kappa/(2\sqrt\pi), approached as d→0d\to0.

Proof

(a) Take θ=0\theta = 0 and write μ=(m−a−c)/[K(E(m)−E(a))]\mu = (m - a - c)/[K(E(m) - E(a))] with E(x)=erfi⁡(xκ/σ)E(x) = \operatorname{erfi}(x\sqrt\kappa/\sigma) and K=π/κK = \pi/\kappa. The first-order conditions in mm and aa are E(m)−E(a)=(m−a−c)E′(m)E(m) - E(a) = (m-a-c)E'(m) and E(m)−E(a)=(m−a−c)E′(a)E(m) - E(a) = (m-a-c)E'(a). Hence E′(m)=E′(a)E'(m) = E'(a), i.e. eκm2/σ2=eκa2/σ2e^{\kappa m^2/\sigma^2} = e^{\kappa a^2/\sigma^2}, so m=±am = \pm a, and a<ma<m forces a=−ma = -m. (b) With a=−da = -d, m=dm = d and erfi⁡\operatorname{erfi} odd, μ∝(2u−c^)/erfi⁡(u)\mu \propto (2u - \hat c)/\operatorname{erfi}(u) in the scaled variables. Setting the derivative to zero: 2erfi⁡(u)=(2u−c^)2πeu22\operatorname{erfi}(u) = (2u-\hat c)\tfrac{2}{\sqrt\pi}e^{u^2}, which is (13A.29). Let g(u)=(2u−c^)eu2−πerfi⁡(u)g(u) = (2u-\hat c)e^{u^2} - \sqrt\pi\operatorname{erfi}(u). Then g(c^/2)=−πerfi⁡(c^/2)<0g(\hat c/2) = -\sqrt\pi\operatorname{erfi}(\hat c/2) < 0, g→+∞g\to+\infty, and g′(u)=2eu2+2u(2u−c^)eu2−2eu2=2u(2u−c^)eu2>0g'(u) = 2e^{u^2} + 2u(2u-\hat c)e^{u^2} - 2e^{u^2} = 2u(2u-\hat c)e^{u^2} > 0 for u>c^/2u>\hat c/2. So the root is unique, and since the profit rate is negative for u<c^/2u<\hat c/2 and tends to zero as u→∞u\to\infty, it is the maximum. (c) Expand eu2=1+u2+O(u4)e^{u^2} = 1 + u^2 + O(u^4) and πerfi⁡(u)=2u+23u3+O(u5)\sqrt\pi\operatorname{erfi}(u) = 2u + \tfrac23u^3 + O(u^5). Then (13A.29) becomes 2u+2u3−c^−c^u2=2u+23u3+O(u5)2u + 2u^3 - \hat c - \hat c u^2 = 2u + \tfrac23u^3 + O(u^5), i.e. 43u3≈c^\tfrac43u^3 \approx \hat c to leading order. (d) With c=0c = 0, μ=2d/[2πκerfi⁡(u)]=κσπκuerfi⁡(u)\mu = 2d/[\tfrac{2\pi}{\kappa}\operatorname{erfi}(u)] = \frac{\kappa\sigma}{\pi\sqrt\kappa}\frac{u}{\operatorname{erfi}(u)}. Since erfi⁡(u)/u=2π∫01eu2s2ds\operatorname{erfi}(u)/u = \tfrac{2}{\sqrt\pi}\int_0^1e^{u^2s^2}ds increases in uu, μ\mu decreases in dd and tends to σκπ⋅π2=σκ2π\frac{\sigma\sqrt\kappa}{\pi}\cdot\frac{\sqrt\pi}{2} = \frac{\sigma\sqrt\kappa}{2\sqrt\pi} as u→0u\to0.∎

Part (d) is a continuous-time artefact. Without costs the optimal strategy trades infinitely often on infinitely narrow bands and collects a finite profit rate, a manifestation of the local time of the diffusion. Costs and discrete monitoring are what make bands finite. The cube-root law in (c) is the same scaling that appears in optimal portfolio rebalancing with proportional costs.

Worked example

(the spread of 13A.7: κ=7.615\kappa = 7.615, σ=0.1605\sigma = 0.1605, stationary s.d. 0.0411; round-trip cost c=0.002c = 0.002, i.e. 20 bp of the long-leg notional for both legs in and out, an illustrative figure for liquid Indian stock futures including slippage):

Band ±d\pm d dd in stationary s.d. Expected cycle (trading days) Profit rate per year (spread units)
Optimal d∗=0.01739d^* = 0.01739 0.42 71.7 0.1143
±0.25\pm0.25 s.d. 0.25 41.6 0.1116
±0.5\pm0.5 s.d. 0.5 85.9 0.1140
±1\pm1 s.d. 1.0 196.7 0.1020
±1.5\pm1.5 s.d. 1.5 381.3 0.0796
±2\pm2 s.d. 2.0 778.3 0.0522

Here c^=0.0344\hat c = 0.0344 and the cube-root approximation gives d≈0.01719d\approx0.01719, within 1.2% of the exact root. The zero-cost bound is 0.16057.615/(2π)=0.12500.1605\sqrt{7.615}/(2\sqrt\pi) = 0.1250 per year. The common "±2\pm2 s.d." rule earns less than half the optimal rate under the model, because the spread reaches two standard deviations rarely (expected cycle more than three years of trading days).

13A.8.4Discrete monitoring#

band_backtest in m13a_ou.py runs the strategy on a daily-sampled path (400 simulated years, optimal band, c=0.002c=0.002). Because the spread jumps past the band between observations, each fill is worse at entry and better at exit than the band level. The mean P&L per trade was 0.0446 against the theoretical 0.0328 and the mean cycle 99.4 days against 71.7, so the realised rate (0.112 per year) was close to the theoretical 0.114. On a much finer grid (50 steps per day) the test file checks that both the cycle length and the P&L per trade match (13A.26)–(13A.28) within 8%. With daily data and a daily shock (0.01) comparable to the optimal band (0.017), the overshoot is a first-order effect on per-trade numbers.

Practitioner notes

  • The optimal band depends on κ\kappa and σ\sigma, which are estimated with the errors of 13A.7. A 26% overestimate of κ\kappa moves d∗d^* only through c^∝κ\hat c\propto\sqrt\kappa, by about 4% via the cube root. The profit rate is more sensitive: it scales roughly with σκ\sigma\sqrt\kappa.
  • Desks use wider bands than the expected-return optimum for reasons outside the model: robustness to a break in the spread, financing and margin costs proportional to holding time, and the Sharpe ratio (Bertram also derives Sharpe-optimal bands, which are wider).
  • There is no stop-loss in the cycle strategy. Under a true OU, any stop-loss lowers the expected return. In reality a stop-loss is a test of the model: a spread at five standard deviations is more likely to have broken than to be a bargain. Leung and Li (2015) solve the optimal stopping problem with a stop-loss.
  • Profit "per unit of spread" is per rupee of the long leg with β\beta rupees short. Margin is posted on both futures legs, so return on capital is lower.

Create a free account

Reading is open to everyone. An account keeps your progress, answers, notes and code drafts, and gives you the study plan, the journals and the simulator. Running code needs an account approved for it.