Expert Advisor Parameters Not Updating. Please Help!

 

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. 

 
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.

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!  

 
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.
 
It must be the code, you have to post it here, please use the SRC-button!!
 
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.
 

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.

 
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.
 
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!   

 

Hi I have this problem as well. I have an EA that you change the parameters on the trail stop, compile save as even close and open the MT4 and the strategy tester will use the initial parameters.

I am using MT4 which is a few years old. Would that be my issue?

 
Angof1497 #: Hi I have this problem as well. I have an EA that you change the parameters on the trail stop, compile save as even close and open the MT4 and the strategy tester will use the initial parameters.

I am using MT4 which is a few years old. Would that be my issue?

Irrespective of changes made to code, the Strategy Tester remembers previously used parameter values and continues to use them until you change or reset them via the input panel.
Reason: