Download MetaTrader 5
To add comments, please log in or register
Share your knowledge. Become a well-known developer!
Conner
21
Conner 2014.10.25 02:32 

I've been programming and testing strategies in my spare time just for fun, but lately a problem with MT4 has made it impossible.  When I run a backtest, change the parameters, and run a backtest again, the second backtest frequently uses the parameters from the first one and so it gives me the exact same results.  This makes optimization completely useless, since I get a list of results that look like this:

The problem 

 Has anyone ever had this problem before? Have you been able to fix it? I use extern rather than input for my variables.  Could that be the problem?  I don't see how, but I'm desperate at this point...  

Any help would be greatly appreciated. 

Carl Schreiber
5959
Carl Schreiber 2014.10.25 06:06  
If you just change the parameters in your code and recompile it this wont change the parameters with wich the backtest will run! You either have to add or rename or delete one of your parameter that this way will work or you have to change them in the window 'behind' the "Expert Properties"-button in the expert-window. (Same with EA on the chart)!
Conner
21
Conner 2014.10.25 14:24  

I'm not changing the parameters in my code.  I'm clicking the "Expert Properties" button and changing them there.  It still doesn't affect the tester.

UPDATE: I downloaded MT5, thinking it would fix all the bugs in MT4, but the exact same thing happened...  What's going on?  Someone please help me!  

Conner
21
Conner 2014.10.26 17:50  
gooly:
If you just change the parameters in your code and recompile it this wont change the parameters with wich the backtest will run! You either have to add or rename or delete one of your parameter that this way will work or you have to change them in the window 'behind' the "Expert Properties"-button in the expert-window. (Same with EA on the chart)!
I'm not changing the parameters in my code.  I'm clicking the "Expert Properties" button and changing them there.  It still doesn't affect the tester.  Once I go to the "navigator", right click, and select refresh, it usually updates.  It's not a problem with my code, since once it updates, the results are different, so the parameters do, in fact, make a difference.  I'm having the same problem in MT5.
Carl Schreiber
5959
Carl Schreiber 2014.10.26 19:34  
It must be the code, you have to post it here, please use the SRC-button!!
Conner
21
Conner 2014.10.27 18:53  
gooly:
It must be the code, you have to post it here, please use the SRC-button!!
It can't be the code.  I even tried using some built-in EAs (like the MACD one) and had the same problem.
Conner
21
Conner 2014.11.01 19:51  

I particularly notice it happening when all the parameters are the same EXCEPT the STOP parameter, so I'm starting to think you were right and it is the code, after all.  I just have no idea what in the code is causing the problem.

whroeder1
13641
whroeder1 2014.11.02 13:06  
math-trader: I'm starting to think you were right and it is the code, after all.  I just have no idea what in the code is causing the problem.
double StopLoss=STOP*Point,TakeProfit=LIMIT*Point;
int OnInit()
  {
:
   AMOUNT=AMOUNT*floor(AMOUNT/MarketInfo(Symbol(),MODE_LOTSTEP));
Each time you change parameters, pair, timeframe the EA goes threw a deinit/init cycle.
So AMOUNT becomes 2X, 4X, ... (Perhaps you meant to normalize AMOUNT?)
STOP and LIMIT may change, but StopLoss and TakeProfit do not change after initial load.
Conner
21
Conner 2014.11.02 19:42  
WHRoeder:
math-trader: I'm starting to think you were right and it is the code, after all.  I just have no idea what in the code is causing the problem.
Each time you change parameters, pair, timeframe the EA goes threw a deinit/init cycle.
So AMOUNT becomes 2X, 4X, ... (Perhaps you meant to normalize AMOUNT?)
STOP and LIMIT may change, but StopLoss and TakeProfit do not change after initial load.

Thank you for pointing that out.  That's a rather foolish typo.

Thank you even more for explaining the major problem I'm having!  I just fixed it on one of my EAs and the optimization worked!  Now I just have to fix the same error on the other hundred EAs I've written...lol

Really, I can't thank you enough!  The EA I fixed (not the one posted here, that one is garbage) is now doing remarkably!   

/
To add comments, please log in or register