Mean Reversion Trading Process in RapidMiner

Lately I’ve been think about becoming more active in trading again. I was reviewing some strategies and decided to recreate a mean reversion trading process in RapidMiner. I found a mean reversion trading¬†strategy that uses Python here and just recreated it in RapidMiner.

The Process

The process is quite simple. You do the following:

1. Load in stock quote data via CSV;
2. Calculate daily returns;
3. Calculate a 20 day moving average;
4. Calculate a rolling 90 day standard deviation;
5. Generate Trading Criteria per the article
6. Wrap it all together and look at the Buy vs Hold and Buy Signals
Mind you, this doesn’t include commission costs and slippage. I suspect that once I add that in, the Buy and Hold strategy will be the best.

PS: to test this, just go to Yahoo Finance and download historical quote data for a stock and then repath it in the Read CSV operator. Use at least a 2 year time period.

Next Steps

I still have several ‘kink’s to work out but I can definitely see the opportunity for optimization here, such as:

  1. Why use a rolling 90 day window? Use parameter optimization to vary that value from 50 to 100.
  2. Why use a 20 day moving average? You could vary between a 10 or 30 day MA?
  3. Write a python script to download EOD stock data and then have RapidMiner loop through it.
  4. Write an commission and slippage subprocess to see if this method IS really profitable or not.
  5. Offload the processes to a RapidMiner Server and have it spit out trading recommendations on a daily basis