Wednesday, December 23, 2009

MetaTrader - Intro to back testing

Welcome back Zulu-traders and forex fans.

Let's take a look at backtesting with the MetaTrader 4 platform.

Backtesting is the first step in evaluating an Expert Advisor. After all, if the robot doesn't make any money in backtesting over a one year period (for example), why consider it any further? More important, backtesting allows you to get a realistic idea of the amount of drawdown to expect.

To learn the basics, check out this 3-part video series YouTube Backtesting Videos.

Disregard the part about downloading data from the Alpari Website. You can pull down updated data inside the MT4 platform by going to Tools, History Center, double-click your pair, select your timeframe and click download.

The Expert Advisor evaluated here is called Framework and can be downloaded for free by clicking on the link. This EA uses crossovers in the Commodity Channel Index (CCI) which is an oscillator whose values typically range between -100 and +100. This system uses 3 separate CCI values with parameters of 5, 25 and 125 representing short, medium and long term values of the CCI indicator.

The trading logic is relatively simple. Take a long positon when the medium CCI is below the zero line and when the short and long term CCI's are both above zero. Take a short position when the medium CCI is above the zero line and when the short and long term CCI's are both below zero. The system uses a take proft of 255 pips and uses no stop loss.

While there is no stop loss, the system will close out all open positions and start to trade in the other direction once it gets a signal opposite any open trades. The system also pyramids (adds to) positions in the current direction as long as trades are open once a certain number of bars have elapsed.

The results from testing were pretty impressive across multiple pairs when tested on a daily timeframe from 1/1/2009 through today. Here are ending, high and low values on a $10,000 account over the test period:

Pair, High, Low, Ending
USD/JPY - $14,962, $8324, $10,606 (big drawdown from the high)
EUR/USD - $12,252, $10,244, $12,252 (all winners)
GBP/USD - $10,705, $8947, $8947 (ended at the low)
GBP/JPY - $14039, $8888, $11865 (stomach churning)

Overall drawdowns from the entry were contained to under 20% from the initial deposit. But there were some roller-coaster changes in account equity for example with USD/JPY going as high as almost $15,000, then drawing down to under $9,000 to end up at $10,606.

In summary, this robot isn't for me but is an interesting learning experience. The drawdowns can be large and (unlike Zulutrade History), all open positions are closed out at the end of the test period, sometimes ending in a sudden closing loss such as the GBP/USD example above. This trades might eventually work out, but I would rather know the closing equity than leave open trades off the grid - like Zulutrade does in their test results.

Also, there are issues with the quality of the test results as shown by the modelling quality metric on the results tab. There are many issues to consider when testing robots, and i've learned alot from this exercise. I've also started to work through Daniel Hernandez's e-book from http://fxreviews.blogspot.com/.

Long story short (and confirmed from Daniel's e-book) if you think MetaTrader expert advisors are an easy path to riches, think again! Enjoy some time off and check back later.

1 comment:

  1. Hi Chris, thanks for the link, hope you can share more link on the EA portion.

    ReplyDelete

Note: Only a member of this blog may post a comment.