Errors, bugs, questions - page 1850

 
Is it a bug?
struct STRUCT
{
  int a;
  
  STRUCT() {} // Если закомментировать, ошибка пропадает
};

void OnStart()
{
  STRUCT Struct = {1}; // cannot be initialized with initializer list
}
 

a bug when using a styler?

Let's assume we were writing using the tab.

//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
   input int x=0;
   #define  TWO_DIM (10000)
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   double      massive[][TWO_DIM];
  }
//+------------------------------------------------------------------+

There's no error.

then we use the styler, we get

//+------------------------------------------------------------------+
//|                                                      ProjectName |
//|                                      Copyright 2012, CompanyName |
//|                                       http://www.companyname.net |
//+------------------------------------------------------------------+
input int x=0;
#define  TWO_DIM(10000)
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   double      massive[][TWO_DIM];
  }
//+------------------------------------------------------------------+
'10000' - unexpected in macro formal parameter list     bug.mq5 7       17
'[' - invalid index value       bug.mq5 13      25

i.e., the styler erases the space between theTWO_DIM(10000)

 
Compilation error
template <typename T>
struct STRUCT
{
  template <typename T1>  
  STRUCT( T1 Value ) {} // 'STRUCT<int><int>' - declaration without type

};

void OnStart()
{
  STRUCT<int> Struct(0); // 'STRUCT<int>' - cannot to apply function template
}
 
A little tip of the hat. Bypassing the assignment operator
template <typename T>
struct STRUCT_COPY
{
  T Value;
  
  STRUCT_COPY( const T& tValue)
  {
    this = (STRUCT_COPY)tValue;
  }  
};

struct STRUCT
{
  int i;
  
  void operator =( const STRUCT& )
  {
    this.i = 5;
  }
};

#define  PRINT(A) ::Print(#A + " = " + (string)(A));

void OnStart()
{
  STRUCT Struct;  
  Struct.i = 1;  
  PRINT(Struct.i);
  
  STRUCT StructCopy1 = Struct;
  PRINT(StructCopy1.i);
  
  // Обходим void STRUCT::operator=(const STRUCT&)
  STRUCT_COPY<STRUCT> StructCopy2(Struct);
  PRINT(StructCopy2.Value.i);  
}

Result

Struct.i = 1
StructCopy1.i = 5
StructCopy2.Value.i = 1
 

What's the right way?

struct STRUCT
{
  template <typename T>
  void operator []( int ) {}
};

void OnStart()
{
  STRUCT Struct;
  
  Struct.operator[]<int>(0); // Нормально
  Struct[0]<int>;            // Ошибка
}
 
another question - I understand, that in MT5 the first copying time of the CopyClose buffer depends on:

1. if previously you didn't receive quotes for a ticker at all, didn't open a chart etc. (depends on the ping, internet speed, hard drive, preparation of the file Bases/Broker/history/ticker/cache/)

2017.04.11 11:27:38.828 время копирования буфера (EURUSD,M1)    проход = 0  время= 8355581
2017.04.11 11:27:38.828 время копирования буфера (EURUSD,M1)    проход = 1  время= 1083

2. if the quotes have been previously received and then the terminal has been reloaded, provided no chart of this ticker has been opened (preparation of the file Bases/Broker/History/Ticker/Cache/)

2017.04.11 11:29:14.672 время копирования буфера (EURUSD,M1)    проход = 0  время= 599396
2017.04.11 11:29:14.734 время копирования буфера (EURUSD,M1)    проход = 1  время= 259
/////////////////////////////
2017.04.12 19:32:46.489 время копирования буфера (FULT,M5)      проход = 0  время= 98167
2017.04.12 19:32:46.557 время копирования буфера (FULT,M5)      проход = 1  время= 155
2017.04.12 19:32:46.557 время копирования буфера (FULT,M5)      проход = 2  время= 14

time is 10-15 times less than p.1


for comparison the access time in МТ4 according to point 2, i.e. after the terminal reset

2017.04.12 19:30:38.831 время копирования буфера EURUSD,M1: проход = 2  время= 276
2017.04.12 19:30:38.831 время копирования буфера EURUSD,M1: проход = 1  время= 434
2017.04.12 19:30:38.831 время копирования буфера EURUSD,M1: проход = 0  время= 2260
2017.04.12 19:30:38.816 время копирования буфера EURUSD,M1: initialized
2017.04.12 19:30:38.666 время копирования буфера EURUSD,M1 inputs: Pair=USDCAD;

i.e. the time after MT4 terminal restart is a few orders of magnitude less.

This time I checked everything on the Windows, without SSD!

When I got the quotes, the terminal was not rebooted, the data was accessed

2017.04.11 11:35:30.648 время копирования буфера (EURUSD,M1)    проход = 0  время= 89
2017.04.11 11:35:30.648 время копирования буфера (EURUSD,M1)    проход = 1  время= 42

Did I get it right that after loading the cache, the terminal needs considerably less time for further requests (starting from the 2nd request)?

Can we somehow reduce the time for the first call after the terminal restart to make it like in MT4?

The code was in https://www.mql5.com/ru/forum/1111/page1870#comment_4856899

Ошибки, баги, вопросы
Ошибки, баги, вопросы
  • www.mql5.com
Форум алго-трейдеров MQL5
 
kaus_bonus:
I have another question - I understand that on MT5 the first copying time of the same CopyClose buffer depends on:

You have a very dirty test method as there is no environment and playback method description at all.

Not specified:

  • bar limits in the window
  • actual data volumes in the terminal databases
  • exactly which server, are the databases on disk? all data must be guaranteed to be on disk.
  • platform and bit rate of testing (under wine? need to specify in details)
  • open windows

Without this the conclusions are unfounded.


For example look at EURUSD M1 - MT5 has more than 6 million bars there (if unlimited mode at charts), but MT4 has how many? A couple of tens of thousands of M1 bars in the actual database?
 
Renat Fatkhullin:

You have a very messy test method as there are no descriptions of the environment and playback method at all.

Not specified:

  • limits of bars in the window

  • actual data volumes in terminal databases
  • what exactly is the server, are the bases on disk? all the data must be guaranteed to be on disk.
  • platform and bit rate of testing (under wine? need to specify in details)
  • open windows availability

Without that the conclusions are unfounded.


I have been asked most of the questions in my post, no problem, I'll give you all the data now.

first of all the answer to the

какой точно сервер, находятся ли базы на диске? все данные обязаны быть гарантированно на диске.

MQ-demo server, the data is loaded, as we are talking about point 2 and point 3 in the previous post. With point 1 everything is clear and there are no questions there - as it was written - data is loaded, cache is formed on the specified path.

лимиты баров в окне

MT4

MT5

фактические объемы данных в базах терминалов

MT4

MT5

платформа и битность тестирования (под вайном? нужно указывать детально)

win XP 32bit, all builds of MT all latest

наличие открытых окон

MT4 - open 1 chart, check with another symbol

MT5 - 1 chart opened, check with another symbol

repeat, reload the terminal, send the script to the chart, select OTHER symbol, data on which has been loaded BEFORE reloading the terminal

MT4

2017.04.12 21:18:31.575 время копирования буфера EURUSD,M1: проход = 2  время= 36
2017.04.12 21:18:31.575 время копирования буфера EURUSD,M1: проход = 1  время= 282
2017.04.12 21:18:31.575 время копирования буфера EURUSD,M1: проход = 0  время= 1871
2017.04.12 21:18:31.575 время копирования буфера EURUSD,M1: initialized
2017.04.12 21:18:31.405 время копирования буфера EURUSD,M1 inputs: Pair=GBPUSD; 

MT5

2017.04.12 21:19:47.735 время копирования буфера (EURUSD,H1)    проход = 0  время= 303951
2017.04.12 21:19:47.735 время копирования буфера (EURUSD,H1)    проход = 1  время= 29
2017.04.12 21:19:47.735 время копирования буфера (EURUSD,H1)    проход = 2  время= 25
 

Here's my test with more detail and more accuracy:

Description of conditions
MetaTrader 4 build 1065
MetaTrader 5 x64 build 1580
Hardware and Operation System
Windows 10 Pro x64, Intel Xeon E5-2690 v3 @ 2.60GHz, RAM: 32 Gb, SSD Disk
Trade server
MetaQuotes-Demo
MetaQuotes-Demo
Limit bars on charts in settings
10 000
10 000
Limit bars in history settings 10 000 000
No limit
Actual number of bars on EURUSD, M1
3.382 million
6.538 million
Verified symbol and period
EURUSD, M1
EURUSD, M1
Open charts
GBPUSD, M1 only, the script is also thrown on it
only GBPUSD, M1, the same script is thrown on it
Results are cold, after the start of the terminal
#0 pass, 1000 records in 680 msc
#1 pass, 1000 records in 2 msc
#2 pass, 1000 records in 2 msc

#0 pass, 1000 records in 113497 msc
#1 pass, 1000 records in 3 msc
#2 pass, 1000 records in 3 msc

Results are warm, second run immediately after the first one
#0 pass, 1000 records in 13 msc
#1 pass, 1000 records in 2 msc
#2 pass, 1000 records in 2 msc
#0 pass, 1000 records in 14 msc
#1 pass, 1000 records in 2 msc
#2 pass, 1000 records in 2 msc

Test files are attached and all times are in microseconds (not milliseconds, 1 millisecond = 1000 microseconds).

Now the conclusions:

  1. The only difference is the speed of initial initialization of the chart cache - 0.6 ms for MT4 vs. 113 ms for MT5

    No problem here - lifting always costs resources.
    Especially when conceptually different architectures are used: MT5 has more complex caches (cache\*.hc files are built from original *.hcc) for the sake of scaling + mandatory full synchronization control with server data (binary *.hcc chunks).

  2. Repeated requests show identical speed - 2-3 microseconds per data copying

    There are no failures in both terminal implementations and everything works fast.
Files:
 

Thank you for your reply.

Overall, the results are as I showed in my posts.

I have been testing on a regular one.

And yet the results between MT4 and MT5 are almost 200 times different (due to -must control full synchronization with server data?? and ping? ).

I kind of got used to it before posting here that it's probably a feature of the terminal. I can even live with it, but it is difficult at some points. For example, as there's no market-screener in MT, I wrote a little script, which adds symbols to market watch, but the prices are only available via CopyClose, they are not available via SymbolInfoDouble or via MqlTick until the symbol is added to the watch, so this script runs "infinitely" long when run with a very large stake. This is just an example.

Reason: