Skip to content
All library documents

Analytical Entry and Exit Thresholds for Ornstein–Uhlenbeck Trading

Code Stratmill research code

Summary

This module implements analytical trading calculations for an Ornstein–Uhlenbeck mean-reverting process, following a published statistical-arbitrage model. Given an entry threshold, an exit threshold, and transaction costs, it computes expected trade length, its variance, expected return, return variance, and a Sharpe ratio that includes a risk-free rate adjustment.

It also searches for symmetric entry and exit thresholds that maximize either expected return or the Sharpe ratio. Plotting routines show how thresholds and model outputs vary with transaction costs or the risk-free rate. These outputs depend on the OU model’s parameters and on the assumed threshold structure; the code does not estimate those parameters, validate that a traded spread follows an OU process, or establish real-world profitability. The analytical measures therefore describe the model’s implications under its assumptions, not evidence of live or out-of-sample performance.

Key ideas

  • The model derives expected return and trade duration measures for threshold trading on an OU process.
  • Transaction costs enter the expected return and influence optimized entry and exit thresholds.
  • Thresholds can be optimized for expected return or for a Sharpe ratio adjusted for the risk-free rate.
  • The implementation assumes a mean-reverting OU process and symmetric thresholds around its long-run mean.
  • The code offers sensitivity plots but supplies no empirical validation or trading results.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.