Strange problem with input values and Strategy Tester optimization

 

I have this code:

input double X = 6;
input double Y = 10;


plus some other code that uses the X and Y variables.

I ran it through Strategy Tester and the result was not good.

So I ran it again but this time with optimization and a bunch of values for each variable. Strategy Tester tested all the possible combinations and three of them actually came out positive.

I picked the best pair and amended the code:

input double X = 9;
input double Y = 15;


Then I ran it without optimization. I just wanted to test the EA with that pair as fixed values.

To my astonishment, the result was disastrous. The profit line plunged and kept going down until it crashed the account.

What in the world?

So I ran the EA again but this time I replaced the variables directly in the code with their respective new values (9 and 15) in the code, ignoring the "input" lines, i.e. I hard-coded the values.

So the result was positive again, the exact same one it had scored in Strategy Tester with optimization.

Does that make sense? Why were the input values applied in the optimized test but apparently ignored in the single run test?

 
whoowl: So I ran the EA again but this time I replaced the variables directly in the code with their respective new values (9 and 15) in the code, ignoring the "input" lines, i.e. I hard-coded the values.
  1. You didn't compile it.
  2. Or you didn't reset the tester to use them. (MT4: tester → Expert Properties → Reset.)
 
William Roeder #:
  1. You didn't compile it.
  2. Or you didn't reset the tester to use them. (MT4: tester → Exspert Propertie → Reset.)

1. I'm pretty sure I compiled it because it's become such a hard habit, but if I didn't, then how come it didn't plunge like a bungee jumper in the previous run, only plunging after I amended the input variables?

2. I'm using MT5 this week, but I checked MT4 and there is no Reset option in Expert Properties.

 
whoowl #: but I checked MT4 and there is no Reset option in Expert Properties.

Really? Reset

Reason: