Here is an index mean reversion system I developed, posting it on here for free as I don't really have the capital base to give the trades justice.

Principles/alpha this algo is trying to capture:

* <5 days mean reversion

* With the 10 month trend

* With the intermediate trend

* Do not trade mean reversion if there is a chance of low volatility => high volatility regime shift.

* Time exits to enforce shorter time frame trading tested but not implemented below as deemed unnecessary.

Goal: alpha which is not index correlated, so the system can be added/rebalanced into a larger tactical portfolio.

I have tried to use all default values for the indicators, everything except the volatility threshold which is a little bit curve fit (but this is to illustrate the principle, best to use adaptive algorithm to adjust per market index). There are obviously 'better' values I could have chosen but stuck with these ones in the interest of avoiding curve fit. Again, optimally would be an adaptive algo to adjust parameters per market index or my preference, aggregate "signal score" of a range of values around the optimal values.

Tested on 10+years: NYSE:SPY, NASD:QQQ, ASX:AFI, Euronext: CAC, Euronext: DAX, results best on QQQ.

Findings: Mean reversion works in both bull and bear regimes, returns are much higher in bear regimes (e.g. 2001-2003, 2007-2009), but returns during bull regimes are extremely low volatility, perhaps a good place to add leverage or extra longs to a momentum strategy or conversely hedge on exit signals. Target volatility, momentum and trend following remain optimal alpha tools for bull regimes.

Addendum: the code below enters on market, significant extra alpha can be captured by ingenious use of limit orders and 24H futures markets....

Code:fast=Average[5](Close) slow=Average[200](close) mac=MACDline[12,26,1](Close) stddev=STD[21](Close) lowvol=Lowest[120](stddev) X=100 IF NOT SHORTONMARKET AND Close > slow AND mac > 0 AND Close < fast AND stddev > 1.05*lowvol THEN BUY X %CAPITAL AT MARKET ThisBarOnClose ENDIF IF LONGONMARKET THEN IF Close < slow OR mac < 0 OR Close > fast THEN SELL AT MARKET ThisBarOnClose ENDIF ENDIF IF NOT LONGONMARKET AND Close < slow AND mac < 0 AND Close > fast AND stddev > 1.3*lowvol THEN SELLSHORT X %CAPITAL AT MARKET ThisBarOnClose ENDIF IF SHORTONMARKET THEN IF Close > slow OR mac > 0 OR Close < fast THEN EXITSHORT AT MARKET ThisBarOnClose ENDIF ENDIF

## Bookmarks