## What is the Ornstein-Uhlenbeck Process?

The **Ornstein-Uhlenbeck Process (OU Process)** is a differential equation used in physics to model the motion of a particle under friction. In financial probability, it models the spread of stocks. It’s also used to calculate interest rates and currency exchange rates.

## OU Process in Pairs Trading

**Pairs trading **was developed at the end of the 1980s, after several crises in the economy hit the market in the previous decades. It’s a way to keep market exposure low while at the same time making a profit from trading.

Pairs trading identifies two similar companies. The two companies should have a high correlation, cointegration, or both. Equity securities for both companies should be **trading outside their normal historical range**. You buy the undervalued security and short sell the overvalued security, betting that the investments will return to their historical norm. Once you have identified the two companies, you’ll want to generate a way to generate trading signals. One way to do this is with the **Ornstein-Uhlenbeck Process**.

In **physics**, a force exerts on a particle to bring the particle back to the mean; a greater the distance from the mean results in more force. The same principle works for modeling spread between a pair of stocks, enabling you to identify when the stock is below the mean (buy) and when it is above the mean (sell).

## Formula

**OU Process = dx _{t} = θ(μ – x_{t})dt + α dW_{t}**

Where:

- x
_{t}= the particle’s current position. - θ = a mean reversion constant.
- μ = the mean particle position
- σ = a constant volatility
- dW
_{t}= a Wiener process (Brownian motion).

## Calculation of the OU Process

Calculating the OU process is quite complex. Ideally, you should be familiar with stochastic calculus, Brownian motion and differential equations. This NYU article covers the basics of what you should know.

Considering there could be millions of dollars at stake, **it’s highly unlikely you’ll want to calculate the OU process by hand.** Instead, there are a multitude of software packages that will perform the calculations for you, including:

**Matlab**: Daniel Charlebois uploaded code to the Mathworks file exchange (found*here*) that can calculate the “Exact numerical solution and plots of the Ornstein-Uhlenbeck (OU) process and its time integral – calculation and plotting of the probability density function (pdf) of the OU process is also performed.”**R**: Package ‘sde’ is for the simulation and inference of stochastic differential equations. You can find the package here.

All of the above tools have multiple regression options built in.

Least squares regression is probably your best bet for modeling the best fit of the data. For an example of how you would apply this to a set of data, check out Calibrating-the-Ornstein (originally from SITMO.com). It includes two methods (least squares and maximum likelihood).

## A Caution on Using an Unmodified Ornstein-Uhlenbeck-process

It sounds easy to use, and (assuming you’re using software to do the calculations), it’s pretty simple to put into action. The problem is, if you’re using an unmodified OU process without a stop-loss, you could **end up losing everything.** The further the stock is from the mean, the more you risk and the bigger you trade. You could end up betting all of your capital and losing everything when the stock falls. It’s wise to include a stop-loss to prevent this from happening.

**References**:

D.S. Ehrmann. The Handbook of Pairs Trading. John Wiley & Sons,

Hoboken, New Jersey, 2006.

**CITE THIS AS:**

**Stephanie Glen**. "Ornstein-Uhlenbeck Process: Definition" From

**CalculusHowTo.com**: Calculus for the rest of us! https://www.calculushowto.com/what-is-the-ornstein-uhlenbeck-process/

**Need help with a homework or test question? **With Chegg Study, you can get step-by-step solutions to your questions from an expert in the field. Your first 30 minutes with a Chegg tutor is free!