Errors, bugs, questions - page 2321

 

I understand that you can check for yourself...

In the Tester, whose event is generated first, the tick or the timer?

For example, the Timer should be called at 12:00:00.000. And there is a tick with the same time. Which is triggered first, OnTimer or OnTick?

 
Vladimir Pastushak:
I had several hundred themes in my favourites, all cleared out... Without my knowledge.

Hello!

Please check again. Your favourites are there.

 
fxsaber:

I understand that you can check for yourself...

In the Tester, whose event is generated first, the tick or the timer?

For example, the Timer should be called at 12:00:00.000. And there is a tick with the same time. Which is triggered first, OnTimer or OnTick?

Timer first

 
Slava:

First the timer

Thank you, good solution.

 
Pavel Kozlov:

Hello!

Please check again. Your favourite topics are in place.

Thank you, everything is back.

 

Forum on trading, automated trading systems and trading strategy testing

Different results. How? Why? What to believe?

Sergey Tabolin, 2018.11.10 12:15

Running a full brute force run. The file is being written. And all the time different length. Maybe because of the TF, but the TF should not affect the result in any way! For further iniit nothing goes!

How, why? Or is it a glitch in the tester?


//+------------------------------------------------------------------+
//|                                               KrL_write_func.mq5 |
//|                                     Copyright 2018, Tabolin S.N. |
//|                           https://www.mql5.com/ru/users/vip.avos |
//+------------------------------------------------------------------+
#property copyright "Copyright 2018, Tabolin S.N."
#property link      "https://www.mql5.com/ru/users/vip.avos"
#property version   "1.00"
//+------------------------------------------------------------------+
typedef void(*TFunc)(void);
TFunc entry_func[7];
//+------------------------------------------------------------------+
enum f_entry
{
   no_f,             // не использовать
   reb,              // отскок
   brd1,             // пробой 1
   brd2,             // пробой 2
   lim,              // лимитный
   lw,               // недельный
   cust,             // пользовательский
};

input    f_entry  func_entry_1         = reb;            // 1-я функция условий входа
input    f_entry  func_entry_2         = brd1;           // 2-я функция условий входа
input    f_entry  func_entry_3         = brd2;           // 3-я функция условий входа
input    f_entry  func_entry_4         = lim;            // 4-я функция условий входа
input    f_entry  func_entry_5         = lw;             // 5-я функция условий входа
input    f_entry  func_entry_6         = cust;           // 6-я функция условий входа

//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
{
   if(paramIncorrect()) return(INIT_PARAMETERS_INCORRECT);
   else
   {
      string   filename    = "KR\\func.txt";
      int      filehandle  = FileOpen(filename,FILE_WRITE|FILE_READ|FILE_TXT|FILE_ANSI|FILE_COMMON);
      if(filehandle != INVALID_HANDLE)
      {
         FileSeek(filehandle,0,SEEK_END);
         string str = string(func_entry_1)+","+string(func_entry_2)+","+string(func_entry_3)+","+string(func_entry_4)+","+string(func_entry_5)+","+string(func_entry_6)+"\n";
         
         if(FileWriteString(filehandle,str) == 0) Print("Ошибка записи файла");
         FileClose(filehandle);
      }
      
      return(INIT_FAILED);
   }

   return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
{
//---

}
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
{
   
}
//+------------------------------------------------------------------+
bool paramIncorrect()
{
   bool     ret_func = false;
   
   if(func_entry_1 == no_f && func_entry_2 == no_f && func_entry_3 == no_f && func_entry_4 == no_f && 
      func_entry_5 == no_f && func_entry_6 == no_f) return(true);
//--- Порядок следования
   if(func_entry_1 == no_f)                                                                                       ret_func = true;
   else if(func_entry_2 == no_f && (func_entry_3 != no_f || func_entry_4 != no_f || func_entry_5 != no_f || 
                                    func_entry_6 != no_f))                                                        ret_func = true;
   else if(func_entry_3 == no_f && (func_entry_4 != no_f || func_entry_5 != no_f || func_entry_6 != no_f))        ret_func = true;
   else if(func_entry_4 == no_f && (func_entry_5 != no_f || func_entry_6 != no_f))                                ret_func = true;
   else if(func_entry_5 == no_f &&  func_entry_6 != no_f)                                                         ret_func = true;
//--- Повторяемость
   if(func_entry_1 == reb  && (func_entry_2 == reb    || func_entry_3 == reb  || func_entry_4 == reb  || 
                               func_entry_5 == reb    || func_entry_6 == reb))                                    ret_func = true;
   if(func_entry_1 == brd1 && (func_entry_2 == brd1   || func_entry_3 == brd1 || func_entry_4 == brd1 || 
                               func_entry_5 == brd1   || func_entry_6 == brd1))                                   ret_func = true;
   if(func_entry_1 == brd2 && (func_entry_2 == brd2   || func_entry_3 == brd2 || func_entry_4 == brd2 || 
                               func_entry_5 == brd2   || func_entry_6 == brd2))                                   ret_func = true;
   if(func_entry_1 == lim  && (func_entry_2 == lim    || func_entry_3 == lim  || func_entry_4 == lim  || 
                               func_entry_5 == lim    || func_entry_6 == lim))                                    ret_func = true;
   if(func_entry_1 == lw   && (func_entry_2 == lw     || func_entry_3 == lw   || func_entry_4 == lw   || 
                               func_entry_5 == lw     || func_entry_6 == lw))                                     ret_func = true;
   if(func_entry_1 == cust && (func_entry_2 == cust   || func_entry_3 == cust || func_entry_4 == cust || 
                               func_entry_5 == cust   || func_entry_6 == cust))                                   ret_func = true;
   
   if(func_entry_2 == reb  && (func_entry_3 == reb    || func_entry_4 == reb  || 
                               func_entry_5 == reb    || func_entry_6 == reb))                                    ret_func = true;
   if(func_entry_2 == brd1 && (func_entry_3 == brd1   || func_entry_4 == brd1 || 
                               func_entry_5 == brd1   || func_entry_6 == brd1))                                   ret_func = true;
   if(func_entry_2 == brd2 && (func_entry_3 == brd2   || func_entry_4 == brd2 || 
                               func_entry_5 == brd2   || func_entry_6 == brd2))                                   ret_func = true;
   if(func_entry_2 == lim  && (func_entry_3 == lim    || func_entry_4 == lim  || 
                               func_entry_5 == lim    || func_entry_6 == lim))                                    ret_func = true;
   if(func_entry_2 == lw   && (func_entry_3 == lw     || func_entry_4 == lw   || 
                               func_entry_5 == lw     || func_entry_6 == lw))                                     ret_func = true;
   if(func_entry_2 == cust && (func_entry_3 == cust   || func_entry_4 == cust || 
                               func_entry_5 == cust   || func_entry_6 == cust))                                   ret_func = true;
   
   if(func_entry_3 == reb  && (func_entry_4 == reb    || 
                               func_entry_5 == reb    || func_entry_6 == reb))                                    ret_func = true;
   if(func_entry_3 == brd1 && (func_entry_4 == brd1   || 
                               func_entry_5 == brd1   || func_entry_6 == brd1))                                   ret_func = true;
   if(func_entry_3 == brd2 && (func_entry_4 == brd2   || 
                               func_entry_5 == brd2   || func_entry_6 == brd2))                                   ret_func = true;
   if(func_entry_3 == lim  && (func_entry_4 == lim    || 
                               func_entry_5 == lim    || func_entry_6 == lim))                                    ret_func = true;
   if(func_entry_3 == lw   && (func_entry_4 == lw     || 
                               func_entry_5 == lw     || func_entry_6 == lw))                                     ret_func = true;
   if(func_entry_3 == cust && (func_entry_4 == cust   || 
                               func_entry_5 == cust   || func_entry_6 == cust))                                   ret_func = true;
   
   if(func_entry_4 == reb  && (func_entry_5 == reb    || func_entry_6 == reb))                                    ret_func = true;
   if(func_entry_4 == brd1 && (func_entry_5 == brd1   || func_entry_6 == brd1))                                   ret_func = true;
   if(func_entry_4 == brd2 && (func_entry_5 == brd2   || func_entry_6 == brd2))                                   ret_func = true;
   if(func_entry_4 == lim  && (func_entry_5 == lim    || func_entry_6 == lim))                                    ret_func = true;
   if(func_entry_4 == lw   && (func_entry_5 == lw     || func_entry_6 == lw))                                     ret_func = true;
   if(func_entry_4 == cust && (func_entry_5 == cust   || func_entry_6 == cust))                                   ret_func = true;
   
   if(func_entry_5 == reb  && func_entry_6 == reb)                                                                ret_func = true;
   if(func_entry_5 == brd1 && func_entry_6 == brd1)                                                               ret_func = true;
   if(func_entry_5 == brd2 && func_entry_6 == brd2)                                                               ret_func = true;
   if(func_entry_5 == lim  && func_entry_6 == lim)                                                                ret_func = true;
   if(func_entry_5 == lw   && func_entry_6 == lw)                                                                 ret_func = true;
   if(func_entry_5 == cust && func_entry_6 == cust)                                                               ret_func = true;
   
   if(ret_func) return(true);
   
   return(false);
}

 
Сергей Таболин:

The cache works.

 

Hello!

I am facing the problem with the "Fixed chart position" slider in MT5 that does not work correctly, for example, when I switch from weekly chart to daily chart it shifts by about 280 days.

At first everything is normal after the terminal installation, but then I loading profiles from the old ones and it starts glitches. And the problem is old.

I am attaching a video with small demonstration...



Files:
test.exe.zip  1300 kb
 

can the warnings be removed in this case? so as not to multiply variables. or in mql it doesn't work like that at all?

private:
   int               number_of_features;
     
public:
                     CBandit(int number_of_features) {                                      
                             this.number_of_features = number_of_features;
                            }
  

declaration of 'number_of_features' hides member declaration at line 24


 
Maxim Dmitrievsky:

can the warnings in this case be removed? so as not to multiply variables. or does this not work at all in mql?

The declaration of 'number_of_features' hides member declaration at line 24


You have already "multiplied" the variable, so here,CBandit(int number_of_features) the variable int number_of_features will already be created, or rather not a variable but a copy of this variable'svalue , so you should write CBandit(int number_of_features_my) or leave it there because nothing will change; the compiler gives a warning on purpose becausebecause by describingCBandit(int number_of_features) you have closed the scope

private:

int number_of_features;

and maybe you should have got this int number_of_features; in the CBandit() method, or maybe not, the compiler keeps track of it

Reason: