Errors, bugs, questions - page 163

 
stringo:
Can you practically justify the expression x = x++; What do you want to say? Why not use increment without subsequent assignment of x++; As it is usually used.
Came out by accident - it's not every day you write in C-like languages, I forgot there's just x++. I was expecting x = x + 1. The result is funny...
 
GODZILLA:

No, it's not! Well there's no data, I asked again... I got it on the fifth request and went, but it's silent and that's it!!!

For Expert Advisors and custom indicators it's better to use event-driven processingmodel. If the processing of events OnTick() or OnCalculate() has not succeeded to obtain all the required data, you should exit the event handler, expecting to have access to the data the next time the handler is called.

I read this too and thought so, but here's what this code gives, for example:

int handle;
datetime inittime;
void OnInit(){

  
  handle = iCustom( "GBPUSD", PERIOD_M2, "examples\ATR", 14 );
  Print("Handle=", handle);
  inittime = TimeCurrent();
}
bool isfirst = true;
void OnTick()
  {
    double val[1];
    int start_pos = 1;
    if( isfirst || TimeCurrent()-5*60 > inittime ){
      int n = CopyBuffer( handle, 0, start_pos , 1, val );
      Print("Получено n=", n, 
        (n==-1)?" ошибка при получении данных из индикатора, ":" нет ошибки при получении данных из индикатора",
        " значение ", val[0] );
    }
    isfirst = false; 
  }

I wait 5 minutes, after that I get the indicator value on each tick (I cut out part of the logs):

2010.10.14 15:47:09 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:47:03 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:47:02 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:47:02 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:47:01 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:47:01 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:46:59 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:46:59 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:46:58 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:46:58 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:45:11 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:45:11 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:45:10 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:45:05 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:45:03 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:45:03 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:45:02 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:45:01 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:45:00 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:44:58 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:44:56 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:44:56 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:44:54 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:44:08 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:44:05 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:44:05 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:43:27 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:43:25 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:43:24 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:43:23 23 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:43:04 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:43:01 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:42:59 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:42:58 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:42:58 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:42:51 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:42:47 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:42:43 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:42:04 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0006792857142856462
2010.10.14 15:41:25 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:41:22 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:41:05 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:41:05 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:41:01 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:59 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:57 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:54 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:41 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:40 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:38 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:36 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:26 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:21 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:21 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007028571428570865
2010.10.14 15:40:18 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:40:14 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:40:13 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:40:07 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:40:04 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:40:02 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:40:02 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:59 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:56 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:54 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:52 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:51 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:50 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:49 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:46 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:45 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:45 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:43 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:42 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:40 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:40 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator value 0.0007364285714285289
2010.10.14 15:39:39 tstincl (EURJPY,M1) n=1 received no error when receiving data from indicator the value 0.0007364285714285289
2010.10.14 15:34:38 tstincl (EURJPY,M1) Received n=1 no error when receiving data from indicator value 0.0007357142857142544
2010.10.14 15:34:35 tstincl (EURJPY,M1) Handle=10

which should change every two minutes, as you see from about 45 minutes new bars on m2 are not available, neither after the first, nor after the second or after the tenth call to them.

Maybe you have something similar?

Question to developers: How to call CopyBuffer correctly? Every time before its call to synchronize timeseries? Then you need to know which timeseries and which character refers to the handle initiator, to know this, you need somewhere to store and transmit this information to all places where you call CopyBuffer: the code gets complicated and cluttered.

 

Question about the tester.

How often are the results of the tester passes stored?

The log shows that if the results are stored in the cache, they are taken from there without recalculation, saving time. I faced a situation when a computer crashed during a long optimization run (the reason is not important). The next optimization run with the same Expert Advisor and the same parameters revealed that nothing was saved - the time had been wasted. Of course, there is a safety measure - to stop and restart optimization every now and then but it is not very convenient. Build 342.

 
Ashes:

Question about the tester.

How often are the results of the tester passes stored?

The log shows that if the results are stored in the cache, they are taken from there without recalculation, saving time. I faced a situation when a computer crashed during a long optimization run (the reason is not important). The next optimization run with the same Expert Advisor and the same parameters revealed that nothing was saved - the time had been wasted. Of course, there is a safety measure, i.e. periodically stop and restart optimization but it is not very convenient. Build 342.

Optimization results are written to the file upon optimization completion. In case of emergency shutdown the results are not remembered.

We will consider what can be done.

Документация по MQL5: Файловые операции / FileWrite
Документация по MQL5: Файловые операции / FileWrite
  • www.mql5.com
Файловые операции / FileWrite - Документация по MQL5
 
stringo:

The optimisation results are written to a file when the optimisation is complete. The results are not remembered in case of an emergency shutdown.

We will consider what can be done.

It would be a good idea.

By the way, I would like to save the optimization results in some usable form, not just pictures. Or maybe I haven't found the right button?

 
Ashes:

This would be a good idea.

By the way, I'd like to save the results of the optimisation in some form suitable for processing, not just pictures. Or maybe I haven't found the right button?

tester\cache\<ea_name>.<symbol>.<period>.<mode>.xml
 
Ashes:

This would be a good idea.

By the way, I'd like to save the results of the optimisation in some form suitable for processing, not just pictures. Or maybe I haven't found the right button?

And I have a question too, how to continue the optimization after a forced stop, I did not find anything about it in the help.
 

sergey1294:
и у меня вопрос тоже есть, как продолжить оптимизацию после принудительного останова, в справке что-то не нашел по этому поводу ни чего.

Simply press the start button.
 
stringo:
tester\cache\<ea_name>.<symbol>.<period>.<mode>.xml

And another MQL5 article : Expert Advisor Testing and Optimization Guide:

After the optimization is complete, you can look in the folder "MQL5\Tester\cache" where you will find the file cci_ma_ea.EURUSD.H1.2.xml that contains numerical values of all parameters and characteristics obtained as a result of optimization.

Optimisation results are saved in the file: ExpertName.SYMBOL.PERIOD.GenerationMode.xml, where:

  • ExpertName - name of the Expert Advisor to be optimized;
  • SYMBOL - symbol;
  • PERIOD - timeframe (M1,H1,...);
  • GenerationMode - mode of ticks generation (0 - "Every tick", 1 - "OHLC on M1", 2 - "Opening prices only".

This file can be opened in Excel for further analysis.

 
stringo:
You simply press the start button.
So the tester should automatically load the list of past runs into the"Optimisation results" tab and continue optimising from where it left off?
Reason: