Questions from Beginners MQL5 MT5 MetaTrader 5 - page 84

 
lobo:

Question: How do I set up what and where so that the signals don't come in? I have not subscribed to any of the signals.


+ and disable the signals tab in the terminal.

 
sergeev:

+ and disable the signals tab in the terminal.


The context menu of the "alerts" tab is not active, you can only "create" there. In the "signals" tab you can only view incoming signals, you cannot unsubscribe or delete them.
 

Good afternoon!!!

I'm trying to figure out mql5 and rewrite EA from version 4, and I've run into a few issues:

1. The compiler writes 'cH' - undeclared identifier in the lineif(fcorH==1) countH=cH; although the variable is assigned. What is the catch?

             if(fdelH==0)                                   // проверить на близость при отсутствии уровня в массиве удаленных
               {
                int cH=countH-1;                            // предыдущее значение счетчика
                ...
                fcorH=1;                                    // перезапись уровня в массиве
               }
             if(f1==0)                                      // если занесение хая в массив разрешено
               {
                if(fcorH==1) countH=cH;                     // если разрешена перезапись уровня, то счетчик отматывается на один назад
                ...
               }

2. the same story with another variable TimeRes:

   for(int y2=0;y2<finish;y2++)                          // поиск ближайших уровней
      {
       double Level=SupRes[y2][0];                       // выбор проверяемого уровня
       double rL=Level-Bid;                              // разность цены и уровня
       if((rL<dPlus && rL>0) || (rL>0 && dPlus==0))      // при наличии положительной разницы
         {
          dPlus=rL;                                      // фиксировать ее
          Res=NormalizeDouble(SupRes[y2][0],_Digits);    // уровень сопротивления
          datetime TimeRes=SupRes[y2][1];                // время сопротивления
         }
      }
   ObjectSetInteger(0,oRes,OBJPROP_TIME,TimeRes);        // отрисовка ближайшего сопротивления

But apart from that in the second example there is a warning"possible loss of data due to type conversion" in thedatetime line TimeRes=SupRes[y2][1];

An array on the global level is combined in this form - double SupRes[][2];

Please tell me what I should do to fix these errors and warnings.

 
WindSW:

Good afternoon!!!

I'm trying to figure out mql5 and rewrite EA from version 4, and I've run into a few issues:

1. The compiler writes 'cH' - undeclared identifier in theif(fcorH==1) countH=cH; though the variable is assigned. What is the catch?

2. the same story with the other variable TimeRes:

In both cases you are declaring a variable inside a condition/cycle, i.e. if the condition is not met, the variable is not defined.

Put the definition of variables at the beginning of the function or make them global.

But besides that, the second example causes the"possible loss of data due to type conversion" warning in thedatetime line TimeRes=SupRes[y2][1];

An array on a global level is combined in this form - double SupRes[][2];

Please advise what to do to fix these errors and warnings?

Or convert it to one type

datetime TimeRes=(datetime)SupRes[y2][1];
Or initially define array and variable as the same type.
 
fyords:

In both cases you are declaring a variable inside a condition/cycle, i.e. if the condition is not met, the variable is not defined.

Put the variable definition at the beginning of the function or make it global.

Put the definition of variables, and the "possible use of uninitialized variable" warnings for cH and TimeRes variables came up.

What to do with it and what to do with"possible loss of data due to type conversion" warning in datetime line TimeRes=SupRes[y2][1]; ???

 
WindSW:

You have defined the variables and got a warning "possible use of uninitialised variable 'cH'".

This is good, but have you given it an initialisation value?

int cH=0;
After all, it is reading the value by the code and if there is nothing there, what can it be read. Here it is a warning.
 
fyords:

Well, either reduce it to the same type of

or initially define array and variable as the same type.
And how can you define array and variable by one type, if array must contain levels as double and time of these levels as datetime?
 
fyords:

datetime TimeRes=(datetime)SupRes[y2][1];

Thank you, your tips have helped. Where can I read about definitions like (datetime)SupRes[y2][1];?
 
WindSW:
And how can you define an array and a variable of the same type, if the array should contain levels as double and time of these levels as datetime?

In this case you will need 2 arrays: double and datetime.

And once the level is found and written to the first array, we need to get the time and write it to the second array.

 
WindSW:
Thank you, your tips have been helpful. Where can I read about (datetime)SupRes[y2][1]; type definitions?

Bringing in the types

Reason: