Expert optimization is failing after some passes

To add comments, please log in or register
lucasvg
26
lucasvg  

Hello all,

I'm facing a strange error. The optimization is usually some passes successfully and then it starts returning only zero trade results, as follows:



Scrolling down, all of the bellow tests return also 0.

After the successful passes, I could see on the Journal that the errors are happening in the following order, considering the same agent:

2019.03.05 13:33:48.619 Core 6 pass 286 tested with error "task rejected by tester agent" in 0:00:00.000

2019.03.05 13:33:48.630 Core 6 pass 286 started

2019.03.05 13:33:48.931 Core 6 pass 286 tested with error "some error after pass finished" in 0:00:00.001

Like in the following log:

I've seen some people having similar errors due to Build 2006, recently released. But their problems weren't exactly the same.

I tried optimizing example indicators, like MACD sample one, and it optimizes properly with all the passes running successfully.

But the errors give me no clue what is possibly wrong.

Also, running on visual mode with the same settings works properly.

Thanks a lot in advance.

lippmaje
378
lippmaje  

Same here. It occurs with build 2007, and build 1995, too.

2019.03.05 18:33:30.673 Tester  1 of 36 passes processed (1 successfully finished) in 0:00:00.174
2019.03.05 18:33:30.674 Tester  35 tasks rejected
lucasvg
26
lucasvg  

Since the MACD expert is working, I tried to compare it with my expert. I removed everything that it was there that could possible be causing problems. I ended up with the following simple code, that still doesn't work! :/

//+------------------------------------------------------------------+
//|                                                GenericTrader.mq5 |
//|                                                     Lucas Vieira |
//|                                             lucasvg@poli.ufrj.br |
//+------------------------------------------------------------------+
#property copyright "Lucas Vieira"
#property link      "lucasvg@poli.ufrj.br"
#property version   "1.00"

#include <Trade/Trade.mqh>

CTrade trade;

input uint ASO_SMOOTHING = 4;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit(){
        trade.SetExpertMagicNumber(123);
        trade.SetDeviationInPoints(10);
  trade.SetMarginMode();
  trade.SetTypeFillingBySymbol(_Symbol);

  return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
    if(!PositionSelect(_Symbol))
          enterPosition();
  }

void enterPosition(){
                double ask = SymbolInfoDouble(_Symbol, SYMBOL_ASK);
      trade.PositionOpen(_Symbol,ORDER_TYPE_BUY,0.01, ask, ask-(0.01)*ask, NULL, NULL);
}

And the following optimization, where I'm optimizing a variable that doesn't change anything:

I have no clue why the MACD example works but mine doesn't :/

lucasvg
26
lucasvg  

anyone has any idea how to solve this?

Thanks a lot!

lippmaje
378
lippmaje  
lucasvg:

anyone has any idea how to solve this?

Yes, I think you need to call ExpertRemove() to unload your expert from cache. This slows down the optimisation somewhat but you get the complete results.

Add this to your OnTick:

void OnTick()
  {
   if(MQLInfoInteger(MQL_TESTER) && TimeCurrent()>D'8.3.2019 23:00')
     {
      Print("*** Wacky Tester Fix *** removing EA at ",TimeCurrent());
      ExpertRemove();
     }
Note the date in the if statement must preceed your testing end date. So if you're testing from Mar 1st to 7th, say, adjust the date accordingly to 6.3.2019 23:00
Files:
lucasvg
26
lucasvg  

Thanks a lot @lippmaje!!

This solution worked more or less at first, because it from 8 successful runs to some more, but still some failures. But then I realized it is this leaking problem, and I closed some graphs that were opened on MT5 due to simulations, and decreased the number of bars on the chart. And now it works!!

Best regards,

Lucas Vieira.

lucasvg
26
lucasvg  

Hello @lippmaje, all

Unfortunately this workaround seems to know work completely. It works for me when I use the dummy code above, but adding more auxiliary indicators and so on, the error comes back. While optimizing, I was monitoring the memory and there is still available memory, according the the Windows Resource Monitor app. Follows bellow the screen shot.


So I still can't make it work :/

MetaCoderX
59
MetaCoderX  
I have the same problem "some error after pass finished" v5 build 2007.
lippmaje
378
lippmaje  
MetaCoderX:
I have the same problem "some error after pass finished" v5 build 2007.
Maybe it's fixed in the latest build 2009, did you try?
MetaCoderX
59
MetaCoderX  
lippmaje:
Maybe it's fixed in the latest build 2009, did you try

2009 build is relased?


Forcing update do not work either, my last version is 2007

To add comments, please log in or register