Errors, bugs, questions - page 1851

 
kaus_bonus:

Thank you for your reply.

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

I have been testing on a regular one.

Not a cheat, it's the same conditions for both systems.


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

About 0.6ms in MT4 I'll figure it out yet. Apparently the data there are already pre-prepared and therefore this figure does not show the real costs.

MT4 has a quite different ideology and actually the terminal copies a huge amount of data for each script/expert on the system level out of the MQL4 code. Therefore, measurements made in MQL4 do not usually demonstrate the actual consumption of resources for data reception. The expenses, of course, exist, but they are at another level - the system is responsible for them.

It is clear that the MT4 mechanism (creating copies of market data for each robot) cannot be applied when your task is scaled to infinite data flows (deep history, tens of thousands of instruments). Therefore, I've had to dramatically change and improve MQL5 by getting rid of Open/High/Low/Close direct accesses and switching to CopyXXX functions. Considering the size of MT5 data, it is too expensive for an Expert Advisor to build the EURUSD M1 copy for 6 million bars.

MT5/MQL5 uses the strategy of loading data on demand without copying in advance, which means a better opportunity to measure real costs from MQL5 code.

Bringing the database into memory, checking synchronization and preparing caches of a complex object in MT5 in 113 milliseconds is acceptable.

 
kaus_bonus:

For example, because MT has no market screener, I wrote a small script which adds symbols to market watch and the prices are only available via CopyClose, neither via SymbolInfoDouble, nor via MqlTick they are not available until the symbol is added to the watch, so this script runs infinitely long when run with a very large amount. This is only as an example.

Instruments do not have to be added to the market overview in order to get history on them. Any reference to the symbol data triggers background data synchronisation.

Now there is a problem with us using an excessive level of caching with the whole chart database lifted to its full depth, even if the latest data is requested. This results in a large memory overrun for screeners that check hundreds of charts.

The task has already been set to change this strategy and pick up the data no deeper than 500 bars from the furthest date of the request. This will allow for painless writing of market screeners.

 
fxsaber:

What's the right way?


You asked, you answered:) Well, yes, it is.
 
Алексей Тарабанов:

You asked, you answered:) Well, yes, that's right.
I never saw the abbreviated template operator call.
 
fxsaber:
I still haven't seen a shortened template operator call.

I haven't worked with structures in ages. If you need to initiate an entire structure array element, it will be a string operation. And the integer element of this converted string you have initiated correctly, which is what the compiler reported. If you want to initiate, compare or otherwise handle arrays of structures, ask how they are represented/stored in MQL. It's nothing complicated and speeds things up a lot.
 
Алексей Тарабанов:
I need to know which syntax entry is the abbreviated version of this
Struct.operator[]<int>(0);
 
fxsaber:
I need to know which syntax entry is the abbreviated version of this
Struct[0]
 
Комбинатор:
Struct[0].

To whom how
 
Комбинатор:
Struct[0].
So as not to browse through the pages, I'll copy the code

Forum on trading, automated trading systems and trading strategy testing

Bugs, bugs, questions

fxsaber, 2017.04.12 14:27

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

void OnStart()
{
  STRUCT Struct;
  
  Struct.operator[]<int>(0); // Нормально
  Struct[0]<int>;            // Ошибка
}

These two calls are different.

Struct.operator[]<int>(0);
Struct.operator[]<MqlTick>(0);

There should be a corresponding abbreviated entry for each. Which one?

 
fxsaber:
I need to know which syntax entry is an abbreviated version of this

No entry can provide what you want. Fundamentally. Semantically.
Reason: