Feb 22, 2012

danw0 - 24 sma close + close-weighted EA

This robot from 18-03-2011 had me excited for a little while, until I eventually figured out what was happening.

It opens trades if a 24 period moving average based upon the period closing prices compared with the weighted-closing prices cross each other. It also gets a stochastic value and doesn't open if oversold/over-brought, and the signal line has to agree with the direction of the trade.

It was among the first robots to use my updated "danw0" code-base, which allowed limited hedging, and also introduces proper trade triggers (in this case, the moving average cross).

The inspiration for the code update came from that fact that I had just moved to Australia a few months previously and opened an account with an Australian broker, who allow hedging. The US had just recently banned it for accounts with US based Forex brokers.

It had good results from a very limited back-test I ran (I went through stages of back-testing or not back-testing robots, depending upon what I had been reading about them at the time). It also performed well on a demo account .... for a while.

Until it failed I really thought I had stumbled upon some magical combination of moving averages that no one had ever thought of before.

Look at these results from a back-test on GBPUSD (1-1-2011 to 1-1-2012)



It actually performed better on GBPUSD than EURUSD, one of the few robots to do so. It was even turning a small profit until near the end of the test.

Look at the performance results - 94.44% win rate! Averages 26 consecutive wins! Amazing! Behold the predictive power of weighted-moving averages!

But wait. The average profit is only $7.87, compared with an average loss of $246.

I don't think the moving averages really do much at all. When reviewing the back-test chart (not shown), it appears to just open an order at random, move in the wrong direction almost immediately, eventually retrace, and then the EA will close it for a small profit.

But I learned that it's also possible to get this high win rate by quickly closing orders as soon as they're in profit, and just let the losses run until they (hopefully) hit your stop-loss.

Look also at the equity graph. See the green line beneath the blue line? This is the actual equity of the test account, while the blue line shows profit. The green lines dips quite far at times. This is the hedging taking effect. On this graph, it shows the green line eventually coming back to the blue, which is when all orders are closed and profits or losses settled.

Soon after designing this robot, I took the idea of hedging even further with another series of robots, where the blue profit line never moves, but the green equity line dips to zero, eventually causing a margin call on the account!

Even though this robot proved to be a loser (like all of my robots to date), I learned a lot from it, and I remember it fondly.