Errors, bugs, questions - page 2955

 

What to do? Packing and unpacking of data doesn't work properly:

This is a test

void OnStart()
  {
   uchar my_array_in[];
   uchar my_array_out[];
   uchar my_array_test[];
   const uchar key[]= {0,0,0,0};

   for(int i1=0; i1<100; i1++)
     {
      int size=777+i1*1024+i1*3+i1;
      ArrayResize(my_array_in,size);
      for(int i2=0; i2<size; i2++)
        {
         my_array_in[i2]=uchar(i2*5956);
        }
      ResetLastError();
      int size_out=CryptEncode(CRYPT_ARCH_ZIP,my_array_in,key,my_array_out);
      if(size_out==0)
        {
         Print("CryptEncode: индекс ",i1,"   ошибка ","  ",GetLastError());
         continue;
        }
      ArrayResize(my_array_out,size_out);
      ResetLastError();
      int size_test=CryptDecode(CRYPT_ARCH_ZIP,my_array_out,key,my_array_test);
      if(size_test==0)
        {
         Print("CryptDecode: индекс ",i1,"   ошибка ","  ",GetLastError());
        }
      else
         if(size_test!=size)
           {
            Print("CryptDecode: индекс ",i1,"   не верный размер");
           }
         else
           {
            for(int i2=0; i2<size; i2++)
              {
               if(my_array_in[i2]!=my_array_test[i2])
                 {
                  Print("CryptDecode: индекс ",i1,"   ошибка в данных");
                  break;
                 }
              }
           }
     }
  }

Result. 4001 Unexpected internal error

2021.02.08 16:37:05.648 Test4 (EURUSD,M1)       CryptDecode: индекс 66   ошибка   4001
2021.02.08 16:37:05.649 Test4 (EURUSD,M1)       CryptDecode: индекс 68   ошибка   4001
2021.02.08 16:37:05.650 Test4 (EURUSD,M1)       CryptDecode: индекс 70   ошибка   4001
2021.02.08 16:37:05.650 Test4 (EURUSD,M1)       CryptDecode: индекс 72   ошибка   4001
2021.02.08 16:37:05.651 Test4 (EURUSD,M1)       CryptDecode: индекс 74   ошибка   4001
2021.02.08 16:37:05.652 Test4 (EURUSD,M1)       CryptDecode: индекс 76   ошибка   4001
2021.02.08 16:37:05.653 Test4 (EURUSD,M1)       CryptDecode: индекс 78   ошибка   4001
2021.02.08 16:37:05.654 Test4 (EURUSD,M1)       CryptDecode: индекс 80   ошибка   4001
2021.02.08 16:37:05.655 Test4 (EURUSD,M1)       CryptDecode: индекс 82   ошибка   4001
2021.02.08 16:37:05.656 Test4 (EURUSD,M1)       CryptDecode: индекс 84   ошибка   4001
2021.02.08 16:37:05.657 Test4 (EURUSD,M1)       CryptDecode: индекс 86   ошибка   4001
2021.02.08 16:37:05.658 Test4 (EURUSD,M1)       CryptDecode: индекс 88   ошибка   4001
2021.02.08 16:37:05.659 Test4 (EURUSD,M1)       CryptDecode: индекс 90   ошибка   4001
2021.02.08 16:37:05.660 Test4 (EURUSD,M1)       CryptDecode: индекс 92   ошибка   4001
2021.02.08 16:37:05.661 Test4 (EURUSD,M1)       CryptDecode: индекс 94   ошибка   4001
2021.02.08 16:37:05.662 Test4 (EURUSD,M1)       CryptDecode: индекс 96   ошибка   4001
2021.02.08 16:37:05.663 Test4 (EURUSD,M1)       CryptDecode: индекс 98   ошибка   4001
Please the developers to resolve this issue
 
DMITRII PECHERITSA:

In the general case, both are unsuitable, because methods are virtual and in the derived class, the method is overridden and already occupied by something else.

And in some special cases, you can do without classes at all

 
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"

ushort a;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   a=0;
//---
   return(INIT_SUCCEEDED);
  }


Expression could not be evaluated

Why can't the variable be seen?

Открой новые возможности в MetaTrader 5 с сообществом и сервисами MQL5
Открой новые возможности в MetaTrader 5 с сообществом и сервисами MQL5
  • 2021.02.08
  • www.mql5.com
MQL5: язык торговых стратегий для MetaTrader 5, позволяет писать собственные торговые роботы, технические индикаторы, скрипты и библиотеки функций
Files:
5555.png  128 kb
 
Борис Крутов:


Expression could not be evaluated

Why can't the variable be seen?

I think it's because of aggressive cutting out unnecessary (empty, unused) variables.

Example:

//+------------------------------------------------------------------+
//|                                                     Expert 1.mq5 |
//|                        Copyright 2021, MetaQuotes Software Corp. |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
//--- input parameters
input int   Input1= 9;
//---
ushort   ushort_d = 19;
uint     uint_d   = 119;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
   ushort_d=8;
   uint_d=GetTickCount();
   int d=9;
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
//---
  }
//+------------------------------------------------------------------+

We can see that'ushort_d' is not calculated and not used while'uint_d' is at least calculated:


Files:
Expert_1.mq5  2 kb
 

Probably not here.

Browsing the forum pages and marking the viewed pages (changing the font from bold to normal) does not work from the browser on the phone and browsing later on the computer. On the phone when browsing later it works fine.

On computers from different addresses, logged in all is normal. Viewing at home, in the village, then in the office)))

On computers vin7, chrome. Website is logged in, chrome is also logged in to the same account.

On my phone android 6 with Apex Launcher and the same chrome. The site is logged in, chrome is also logged in to the same account as on the computers.

 
Vladimir Karputov:

I think because of the aggressive cutting out of unnecessary (empty, unused) variables.

Example:

We see that'ushort_d' is not calculated and not used, while'uint_d' is at least calculated:


***

It does not work like that either. And if we change 'ushort to int', the programmer sees the variable

Открой новые возможности в MetaTrader 5 с сообществом и сервисами MQL5
Открой новые возможности в MetaTrader 5 с сообществом и сервисами MQL5
  • 2021.02.09
  • www.mql5.com
MQL5: язык торговых стратегий для MetaTrader 5, позволяет писать собственные торговые роботы, технические индикаторы, скрипты и библиотеки функций
 
Boris:

***

This doesn't work either. And if you change ushort to int, it sees the variable

Insert the code correctly (use button Code).

 
Vladimir Karputov:

Insert the code correctly (use the button ).

#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"



ushort=GetTickCount64();
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
a=GetTickCount64();
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
  a=a++;
  Comment("a: ",a,"/n");
}
Исправил
 
Boris:

The code does not compile because of a huge number of errors. Fix the code.

 
#property copyright "Copyright 2021, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"



ushort a;
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit()
  {
//---
a=(ushort)GetTickCount();
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit(const int reason)
  {
//---
   
  }
//+------------------------------------------------------------------+
//| Expert tick function                                             |
//+------------------------------------------------------------------+
void OnTick()
  {
  a++;
  Comment("a: ",a,"/n");
}
Vladimir Karputov:

The code does not compile because of a huge number of errors. Fix the code.

Fixed by