EA Builders / MQL / Using VTS

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?


  iExpertAdvisor - MetaTrader Expert Advisor Builders

Leave a Reply

Your email address will not be published. Required fields are marked *