# Mean Reversion Strategies

** Mean reversion strategies,** also called pairs trading, tend to capture market anomalies or inefficiencies between prices of stocks, ETFs or commodities with similar behavior. These assets usually pertain to the same industry and are affected by the same supply and demand dynamics. So, in normal conditions, it is expected that both assets have a similar path.

In some occasions, the relative prices of a pair of assets can deviate from its mean and this generates trading opportunities in which one can buy the stock with the lower price and sell the stock with the higher price.

To take advantage of the differences that might arise between stocks with similar properties, a practical approach is to make a ratio between the assets returns and calculate a historical thresholds for this ratio such as one and two historical standard deviations.

The strategy executes orders when the ratio of the prices or the ratio of the returns moves beyond one or two standard deviation, going long on the cheaper asset and going short on the outperformer asset. There are statistical techniques that are suitable to find stocks with similar performance in the past that could be suitable for this type of strategy.

### Identifying Assets Exhibiting Mean Reversion

Researchers and analyst can conduct co-integration test such as the ** Augmented Dickey Fuller (ADF) test** between a lists of stocks to determine good picks for a

**. Also the**

*mean reverting strategy***and the**

*Hurst Exponent***are used as methods to identify stocks that have similar behavior.***

*Variance Ratio test*Similarly, it is also possible to design a ** mean reverting strategy** for a single stock. We can use the

**(BB) technical indicator to set up a mean reversion strategy. First, it is necessary to choose a market that is moving within a range (without trend), and then we can spot the Bollinger Band and make trading decisions. When the price touches the upper band of the Bollinger Band (sell trade) and when the price touches the lower band of the Bollinger Band (buy trade).**

*Bollinger Band*### Additional Notes (Advanced / Optional)

It is possible to perform the CADF (Cointegrated Augmented Dickey Fuller) test between two stocks by using the residuals of a linear regression model for the two asset prices. The CADF is performed with the residual series from the linear regression, and the null hypothesis states that there is a unit root between the two series* and the alternative hypothesis states that both series are stationarity.

If we have evidence to reject the null hypothesis of the presence of a unit root, we have evidence for a stationary series (and cointegrated pair) and can create a stationary portfolio between the two assets in the framework of a mean reverting strategy.

** The pair ratio of the series will not recover to a certain "mean" because it follows a stochastic process.*

Likewise the ADF can be used to determine if a single time series of an asset prices is stationary or not. Other useful tests for determining if a time series can be mean reverting are the Hurst Exponent and the variance ratio. The goal of the **Hurst Exponent** is to provide us with a scalar value that will help us to identify whether a series is mean reverting, random walking or trending. The output of this test is a coefficient between 0 and 1. A value lower than 0.5 implies that the series can be mean reverting for a certain period. Values equal to 0.5 are indicative of a random walk in the time series, and values higher than 0.5 are associated with a trending behaviour.

On the other hand the **variance ratio** test assesses the null hypothesis that a univariate time-series is a random walk. It gives the probability (p-value) that the null hypothesis of a random walk process of the variance of the price series is true or the Hurst Exponent is 0.5.

If the p-value of the variance ratio test is small (p-value < 0.05) we can reject the null hypothesis of a random walk process. This means that the variances between the different returns lags of the time series are not equal.

On the other hand, if the p-value is greater than 0.05, we cannot reject the null hypothesis of a random walk process. This means that the time series could be modeled by a random walk with the form P_t = P_{t-1} + µ + e_t, where µ is a constant and e_t is independent and identically distributed. A key implication of this model is that the variance of (P_t - P_s) is linear in the lag between t and s.

#### Course Downloads

- Introduction to Quantitative Trading
- Quantitative Trading - Advantages and Disadvantages
- Types of Quantitative Trading Strategies
- Momentum Strategies
- Mean Reversion Strategies
- Market Making Strategies and Day Trading Strategies
- How to Generate Trading Ideas
- Designing A Trading Strategy For Profit
- Backtesting a Trading Strategy - Considerations
- Risk Management of a Trading Strategy
- Risk Indicators - VIX Index and TED Spread
- Plotting the VIX Index and TED Spread in R
- Introduction to Quantmod in R
- Downloading Data Using Quantmod Package in R
- Creating Charts with Quantmod
- Data Analysis with Quantmod in R
- Measuring Overall ETFs Performance
- Quantstrat Example in R - EMA Crossover Strategy
- Quantstrat - EMA Crossover Strategy - Performance and Risk Metrics
- Quantstrat Example in R - RSI Strategy
- Quantstrat Case Study - Multiple Symbol Portfolio

# R Programming Bundle: 25% OFF

**R Programming - Data Science for Finance Bundle**for just $29 $39.