There are several ways to test for mean reversion properties in securities and here is a way that looks at the spread between a cointegrated pair of securities. The following algorithm uses an (already known) cointegrated pair of security (Royal Dutch Share stocks) and goes long or short Royal Dutch Share A according to the current spread's deviation from the mean.
If the Spread is
- Greater than or less than Average_spread +- 2*Standard_deviation the algo will go long or short accordingly.
The algorithm does limit leverage a bit. It currently uses Royal Dutch Share stocks (A and B) to test, so perhaps playing around with different stocks would provide better returns.
I feel this algorithm has a lot of potential so will definitely try and take new suggestions for improvement.
-Seong