Articles by: David Williams

New Way to Get More MetaTrader Price Data

New Way to Get More MetaTrader Price Data

If you do any back testing using the Strategy Tester, you may be interested in this.

If you don’t already know, the Strategy Tester is a back tester that comes with MetaTrader (MT).  To find it in your MT platform,  go to the View tab and select Strategy Tester.

Used to be when you needed more historical data you just pressed the PageUp key on your keyboard.

Pressing the PageUp key scrolled back through time on your chart. When you hit the point where you had no more price data, your MT platform would connect to your broker’s server and load more data.

For example, suppose you opened a 1 minute EURUSD chart and pressed the PageUp key.  It might go back to about 2 weeks ago and stop.  Then you’d press the PageUp key a few times and it would load more data.

It doesn’t work like that anymore.  I’m not sure why, but it’s not a big deal.  There’s another way that’s just as easy.

In your MT platform, go to the Tools tab and select History Center.  This opens a window that shows all of your available Symbols.

Expand the Forex menu, choose your Symbol and press the Download button.

This will download all of the price data available for that Symbol and Timeframe.   The download may take a while –  it  depends on your network connection.

I’ve posted some screenshots of this on the forum.

Here is the link:

http://www.iexpertadvisor.com/forum/messages.aspx?TopicID=221#post654

Note:  If you have a live account and need more data, don’t be afraid to ask your broker.  I’ve been able to get tick data for some currencies just by asking (nicely).

How do you know you aren’t fooling yourself? Are you curve fitting your EA?

Are you curve-fitting your EA?

Creating input parameters for an Expert Advisor is easy. It’s easy in MQL and it’s easy in VTS.

In MQL you just use the keyword extern. It looks like this:

extern int StopLoss=200;

There are a couple of ways to do it in VTS. When you create a Variable Element you can set the scope as extern. Or you can use the Input Manager. You can read more about the Input Manager here: VTS->Help->Input Manager

Input parameters appear on the input tab when you attach an EA to a price chart.

They are very powerful. Input parameters allow you to change the behavior of your EA without rebuilding it.

They are especially useful for testing. You can change the values and see how your EA performs. The MetaTrader Strategy Tester even allows you to run a back-test that automatically optimizes your input parameters.

That’s powerful, but it’s not the most powerful way to use input parameters.

The most powerful use of an input parameter is to find out if you’re fooling yourself.

How so?

I’ve written about curve fitting before. (On page 29 of Automatic Alpha I write about curve-fitting and the technique I’m about to describe here.)

Basically, to curve-fit means to create an EA that works for a specific time period.

It’s not that hard to do. As matter of fact you can do it to yourself without even realizing it!

Luckily, there’s a way to find out.

Robustness is a term used when designing a control-system .

(An example of a simple control system is the thermostat in your house: when the temperature drops, the heat is turned on. When the temperature rises, the heat is turned off).

Anyway, robustness defines the stability of a control system. Think of it this way: A stable system acts like a marble inside a bowl. If you gently shake the bowl, the marble will move for a little while, but it will eventually stop and settle at the bottom of the bowl.

An unstable system acts like a marble on the top of an upside down bowl. If you gently move the bowl the marble will fall off and roll away!

Why am I talking about this? Because an EA that has been curve-fit behaves like an unstable system.

Shaking the bowl is like changing the input. How do you shake an EA?

You change its input parameters.

So, to test your EA for robustness you vary its input parameters.

Suppose you have an EA that uses a 12 period moving average to open trades. You change the period from 12 to 24 and record your EA’s performance.

If your EA performs significantly different when you change the period of the moving average, then the EA is not robust. It’s sensitive to changes.

Does this mean it is a bad EA? Not necessarily. It means that it’s sensitive to changes in its input. So, you should not be terrible surprised if the EA’s performance changes in the future, because, well, things in the future change.

The bottom line: if the EA is super-sensitive to changes it is probably curve-fit. It’s likely that it will not perform in the future the way that it has in the past. (If you are buying a black-box EA, all I can say is “caveat emptor”.)

When you build an EA with VTS, use the Input Manager to create input parameters for some of your indicator parameters.

This way you can test and find out: Are you fooling yourself?