MT5 and speed in action - page 56

 
Renat Akhtyamov:
Gentlemen of the prog...
Read first about memory allocation in the computer, then how and by what means it is done, then how to clean and read from and to is not difficult. At least more reasonable suggestions to the developers are possible

You wouldn't know about it on mt4 ?
You use the predefined Ask Bid yourself ?
In mt5 for the entireMqlTick structure they are missing for some reason.
Call the function, fill the structure, and only then get the value.
Or immediately get the value, is there a difference?

Or it is not in my direction?
You should at least indicate who you are writing to ))

 
Roman:

Predefined variables, for the current tick, would probably be better.

The developers have previously explained that there is a fundamental limitation to direct access

void f()
{
        MqlTick t1 = _Tick;
        MqlTick t2 = _Tick;
}

and in general, t1 is not equal to t2. Moreover, field values inside both t1 and t2 may end up referring to different ticks at all

 
A100:

The developers have previously explained that there is a fundamental limitation to direct access

and in general t1 is not equal to t2. Moreover, field values inside both t1 and t2 can refer to different ticks, even though they are linked fields (they should refer to the same tick).

Brr, what's the fundamental limitation?
The structure in your example is unnecessary, it doesn't need to be filled.

A value came from the socket and was written into variable _Ask, _Bid, etc. according to the structure.
_Ask != _Ask according to you?
A restriction occurs if you fill the structure, which takes some time.
You don't need to fill it, but give_Ask, _Bid, etc. directly.

 
Roman:

Brr, what is the principle limitation?
The structure in your example is unnecessary here, it does not need to be filled in.

void f()
{
        double ask1 = _Ask;
        double ask2 = _Ask;
}

You can rewrite it without the structure. In general case ask1 is not equal to ask2

 
A100:

You can also rewrite it without the structure. In general case ask1 is not equal to ask2

I.e. these are requests to the non-synchronous environment, and the response is received by the current state of the environment? And OnTick is catching the current tick and working out the EA, but at the same time requests by the tick structure when the EA is working out can get answers from the next ticks?

 
A100:

You can also rewrite it without the structure. In general, ask1 is not equal to ask2

So you don't have to use 100500 digits, where the last digit of a real number differs 0.0000000000000000000001
For each variable a different digit, for price double maximum 8.

 
Renat Fatkhullin:

Released beta 2652, of importance:

  • improved compile interrupts (by 22%)
  • dramatically faster SymbolInfoTick access.

22% good.

SymbolInfoTick - on my home machine, I noticed by eye that it didn't alerts. However, did a filter on these alerts in the Log and saw that there were many more than the 2650 issued during the same period twenty-four hours ago.

Sent both logs to the PM.

 
Valeriy Yastremskiy:

I.e. these are requests to a non-synchronous environment, and the response is based on the current state of the environment? And OnTick is catching the current tick and working out the EA, but the requests by the tick structure when the EA is working out can get answers from the next ticks?

Yes.

 
Renat Fatkhullin:

For mass ticking work, put in more memory.

4gb (price €20) is nowhere near good in 2020 when it comes to analytics and research.

We are talking about a one-off call to CopyTicks. It's done in order to make a virtual backtest on these ticks in OnInit, and then to continue it in real-time, feeding only fresh ticks.

As a compromise, I propose to release the memory in the Terminal immediately after the CopyTicks called in OnInit. Then we don't have to introduce a forced cooling function for CopyTicks.

Right now Sleep-version of cooling is very crutchy. But I showed above how this crutch saves memory.


Now it turns out that 20 Expert Advisors run fast even on slow VPS. But starting them up is a serious problem.


Here is an Expert Advisor that shows the problem.

// Демонстрация 10-ти секундного удержания в памяти ненужных данных CopyTicks.
#define  PRINT(A) Print(#A + " = " + (string)(A))

input datetime inFrom = D'2020.06.01'; // С какой даты анализировать историю

int OnInit()
{
  MqlTick Ticks[];
  
  Print("Before CopyTicks:");
  PRINT(MQLInfoInteger(MQL_MEMORY_USED));     
  PRINT(TerminalInfoInteger(TERMINAL_MEMORY_USED));
  
  PRINT(CopyTicksRange(_Symbol, Ticks, COPY_TICKS_ALL, (long)inFrom * 1000));
  ArrayFree(Ticks);
  
  Print("After CopyTicks:");
  
  for (int i = 0; i < 10; i++)
  {
    PRINT(i);
    PRINT(MQLInfoInteger(MQL_MEMORY_USED));    
    PRINT(TerminalInfoInteger(TERMINAL_MEMORY_USED));
    
    Sleep(1000);
  }
  
  return(INIT_FAILED);
}


Result.

2020.10.14 08:49:24.016 Before CopyTicks:
2020.10.14 08:49:24.016 MQLInfoInteger(MQL_MEMORY_USED) = 0
2020.10.14 08:49:24.031 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 864
2020.10.14 08:49:25.399 CopyTicksRange(_Symbol,Ticks,COPY_TICKS_ALL,(long)inFrom*1000) = 14372119
2020.10.14 08:49:25.465 After CopyTicks:
2020.10.14 08:49:25.465 i = 0
2020.10.14 08:49:25.465 MQLInfoInteger(MQL_MEMORY_USED) = 1
2020.10.14 08:49:25.499 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 1796
2020.10.14 08:49:26.594 i = 1
2020.10.14 08:49:26.594 MQLInfoInteger(MQL_MEMORY_USED) = 1
2020.10.14 08:49:26.630 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 1796
2020.10.14 08:49:27.729 i = 2
2020.10.14 08:49:27.729 MQLInfoInteger(MQL_MEMORY_USED) = 1
2020.10.14 08:49:27.762 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 1796
2020.10.14 08:49:28.852 i = 3
2020.10.14 08:49:28.852 MQLInfoInteger(MQL_MEMORY_USED) = 1
2020.10.14 08:49:28.884 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 1796
2020.10.14 08:49:29.977 i = 4
2020.10.14 08:49:29.977 MQLInfoInteger(MQL_MEMORY_USED) = 1
2020.10.14 08:49:30.009 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 1796
2020.10.14 08:49:31.102 i = 5
2020.10.14 08:49:31.102 MQLInfoInteger(MQL_MEMORY_USED) = 1
2020.10.14 08:49:31.136 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 1796
2020.10.14 08:49:32.224 i = 6
2020.10.14 08:49:32.225 MQLInfoInteger(MQL_MEMORY_USED) = 1
2020.10.14 08:49:32.257 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 1796
2020.10.14 08:49:33.348 i = 7
2020.10.14 08:49:33.348 MQLInfoInteger(MQL_MEMORY_USED) = 1
2020.10.14 08:49:33.381 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 1796
2020.10.14 08:49:34.468 i = 8
2020.10.14 08:49:34.468 MQLInfoInteger(MQL_MEMORY_USED) = 1
2020.10.14 08:49:34.501 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 1796
2020.10.14 08:49:35.593 i = 9
2020.10.14 08:49:35.593 MQLInfoInteger(MQL_MEMORY_USED) = 1
2020.10.14 08:49:35.605 TerminalInfoInteger(TERMINAL_MEMORY_USED) = 860
 
fxsaber:

22% - fine.

SymbolInfoTick - on the home machine I noticed by eye that there were no alerts. However, did a filter on these alerts in the Log and saw that there were many more than the 2650 issued during the same period twenty-four hours ago.

Sent both logs to the PM.

Acceleration by a factor of ten in cases of mass parallel access.

For other cases only processor, memory and operating system upgrade.