Feb 8, 2012

danw2 - cci + ma + oc2 EA

Here is a more recent robot, which I coded at the beginning of October, 2011. It's among the latest code base.

It's designed to run on the hourly time frame. Stop loss defaults to 20 pips, with a 50 pip trailing stop.

This robot will open a market BUY if the previous candle opened below a moving average (set to 26, EMA, PRICE_HIGH), but closed above it (i.e., if the previous candle crossed the moving average).

The process is reversed for a SELL signal (but the candle must cross a moving average set to PRICE_LOW) .

If the price is already well above the moving average, we assume we're in a trend, and look to enter at a good price. Thus, it waits for pull-backs, defined by looking for an open above/below a reversal candle.

The EA will close a BUY order if the previous candle has closed below the high moving average, and the order is in profit, and the opposite for SELL.

Despite it's name, there's no sign of the CCI indicator being used in the EA. I vaguely remember taking it out, finding that it performed better without it. At the time I was having a run of good luck with EA's using the CCI indicator, so this robot must have been some sort of trial off-shoot of those.

So, how does it perform? Not too well, as it turned out.

It shows some signs of life on one back test, EURUSD, Jan 2011 to Jan 2012. Almost enough to get excited about - a $900 profit with an initial $10,000 account, using small lot sizes (the lot size is automatically calculated at 1% of the balance, so 0.10 with $10,000) over the course of a year.


However, sometime during 2011, after having staggering results with some very simple robots, I got suspicious and ran the same back-tests on different installs of MetaTrader 4, using presumably different history data, and got very different results. 


An almost $3,000 loss.

Something is clearly very wrong with my historical data, and I can't trust MetaTrader back-tests at all!

Note also that on the first test, the robot does well until about the middle of it's run, and then starts declining. This is about June, and I see this in many of my robot back tests, which presumably means my historical data is messed up until about then. I would love to know what happened to the history data.

I believe I forward tested this particular robot on a demo account for a short time, but it doesn't stand out in my memory, so I assume it bombed pretty quickly.

I include it here mostly to illustrate the difference in back tests. It was very depressing to learn that I had wasted so much time testing robots, and getting excited, only to find that my data was messed up.

In trying to find the problem, I downloaded history data from different sources, but they all seemed to give different results. Very frustrating.