In this series, we cover some basic trading strategies that can help you get started with developing your own automated trading systems.

Download IPython Notebook here.

## Mean Reversion Models

Mean-reversion strategies work on the assumption that there is an underlying stable trend in the price of an asset and prices fluctuate randomly around this trend . Therefore, values deviating far from the trend will tend to reverse direction and revert back to the trend. That is, if the value is unusually high, we expect it to go back down and if it is unusually low, go back up.

How do we identify the underlying trend? That?s the essence of this strategy! Consider the dummy example below:

We calculate the 90-day Moving Average(90d MA) of the stock price and treat that as the underlying stable trend. We also calculate the 30-day Moving Average(30d MA) and can see that it zig-zags around the 90d trend. Now we can build the following strategy:

- When the value of 30d MA falls below 90d MA we expect it to revert back to the 90d line. That is, the current price is too low and likely to increase. Hence this is a signal to buy
- Similarly, if the value of 30d MA rises above 90d MA we expect it to fall back to the 90d line. Hence the current price is too high and is a signal to sell

Let?s consider some real world examples and applications of this strategy.

We discussed the application of mean reversion models to a single stock, portfolio of stocks and pairs trade in this notebook. In the next tutorials we will talk about momentum and pairs trading strategies.