Errors, bugs, questions - page 2528

 
Who knows how to contact the moderator? Or maybe someone can give me a hint? My stats show a refill, even though there was never one. What is it and how to fix it?
 

Is this behaviour correct ?

//+------------------------------------------------------------------+

//|                                                                  |

//+------------------------------------------------------------------+

class name

  {

public:

   int func()

     {

      static int t=0;

      t++;

      return t;

     }

  };

name A,B;

//+------------------------------------------------------------------+

void OnInit()

  {

   Print("A "+A.func());

   Print("B "+B.func());

  }

//+------------------------------------------------------------------+

/*

2019.08.10 20:39:57.533 MyTest (EURUSD_i,H1) A 1

2019.08.10 20:39:57.533 MyTest (EURUSD_i,H1) B 2

Expected

2019.08.10 20:39:57.533 MyTest (EURUSD_i,H1) A 1

2019.08.10 20:39:57.533 MyTest (EURUSD_i,H1) B 1

Since different instances of classes are declared

 
Vladimir Pastushak:

Is this behaviour correct ?

of course
 
TheXpert:
of course

So static variables are visible outside of their objects ?

 
Vladimir Pastushak:

So static variables are visible outside of their objects ?

And if it were your way, what would be the point of statics?

class name{
  int t=0;
public:
   int func() {
     return t++;
   }
};
 
Everyone is welcome to participate in the thread about CPU testing for optimisation.
 

Hello,

Noticed a bug replicated on several brokers in MT5 2085.


1) If the rectangle has an end date in the future (e.g. 2020), it will disappear from the screen when zoomed out, when zoomed in down it will reappear.

2) If a chart has bars with dates from the future, (e.g. custom tick chart where bars start in October 2019), then it is impossible to draw on it, when I select a line and a rectangle and click on the chart and draw nothing happens. Then it turns out that the object has been drawn crooked.


Please figure out what's wrong and fix the error. I can make a video if needed. Thank you!

 
Please help me to find it out. The following code in the tester opens the set-file loading window by calling the corresponding menu.
#include <WinAPI\winuser.mqh>

#define  GA_ROOT           0x00000002

#define  WM_COMMAND                     0x0111
#define  WM_CONTEXTMENU     0x007B

#define  DTM_SETSYSTEMTIME 0x1002

#define  MN_GETHMENU     0x01E1  

#define  PRINT(x) ; Print(#x, ":", string(x))
#define  PRINT64(x) ; printf("%s%s%#.08x", #x, ":", x)

long GetHandle(long handle, int &controls[]){
   long next_handle = handle;                                                                        
   for (int i = 0; i < ArraySize(controls); i++){
      next_handle = user32::GetDlgItem(next_handle, controls[i]);
      PRINT64(next_handle);
   }           
   return next_handle;                
} 

void OnStart(){
  long RootHandle = user32::GetAncestor(::ChartGetInteger(0, CHART_WINDOW_HANDLE), GA_ROOT);
  PRINT64(RootHandle);  
  
  int controls[] = {0xE81E, 0x804E, 0x28EF, 0x28FE}; 
  long handle = GetHandle(RootHandle, controls);
  PRINT64(handle);
  
  
//  PRINT(user32::SendMessageW(handle, WM_CONTEXTMENU, 0, -1));
  PRINT(user32::PostMessageW(handle, WM_CONTEXTMENU, 0, -1));
  PRINT("Sleep");
  Sleep(1000);

  const long hpopup=user32::FindWindowW("#32768", NULL);
  PRINT64(hpopup);

  const long hmenu = user32::SendMessageW(hpopup, MN_GETHMENU,0,0);
  PRINT64(hmenu);
  
  uint id=user32::GetMenuItemID(hmenu, 0);
  PRINT64(id);
  
  PRINT(user32::SendMessageW(RootHandle,WM_COMMAND,id,0)); // Выбор пункта меню "Загрузить"
/*
  Sleep(100);
  
  const long hwnd = GetLastActivePopup(RootHandle);
  PRINT64(hwnd);
*/  
}

This code works fine when the Options tab is selected in the Tester. Then the highlighted comment in the code SendMessage returns 1.

But if you change the tab, the menu is called, but it doesn't select "Load" item - SendMessage returns 0. At the same time manually in the opened menu it is possible to select item without any problems.

Can you tell me where the problem is, that SendMessage returns zero?

 

Hi all!

I rented a VPS and stopped copying signals. When I unplug the VPS, everything works. Log gives out errors. What can it be related to?

2019.08.12 23:03:18.632 MQL5.community: authorization failed

2019.08.12 23:03:18.632 Signal: '77060013': failed to get list of signals, connection error

Files:
 

Question about permissible characters in identifiers. Example

#define  MACRO( x )              x## AAA
void OnStart()
{
        int xyz;
        int MACRO( BBB ); //нормально
}

The result:

Received a variable identifier with a space.

If we rewrite the example like this:

#define  MACRO( x )              x##:AAA
void OnStart()
{
        { int MACRO( BBB ); } //(1) //нормально
        { int BBB:AAA;      } //(2) //Error: 'AAA' - semicolon expected
}
then we can formulate a contradiction: What is the difference between (1) and (2)?