MT5 and speed in action - page 86

 
fxsaber:

@Anton, in many standard functions you can specify NULL instead of a character. Does it affect the speed of execution?

Or does it make no difference for Terminal/Tester?

Symbol(), _Symbol entries are equivalent to NULL (where NULL is allowed instead of a symbol name).

In this case, there is no extra check for the existence of the current symbol, the presence of the current symbol in the Market Watch and unnecessary call properties of the current symbol, as properties of the current character is cached

That is, if you specify a simple string parameter instead of Symbol(), _Symbol or NULL, then checks for the full program and still request properties

 
Slava:

Symbol(), _Symbol entries are equivalent to NULL (where NULL is allowed instead of symbol name).

In this case there is no unnecessary check for existence of the current symbol, for presence of the current symbol in Market Watch and unnecessary call of current symbol properties, as properties of the current symbol are cached

Slava, can you comment: on stocks, the tick price in the symbol specification is set to '0'. And this is what support says:

"Received confirmation from the technical department. Please be advised that it is not possible to fill in the 'tick price' parameter for the stock. The value will be defaulted to 0.
Thank you for contacting us!"


Is this really the case? It is in the Symbol Specifics that the tick price is zero just for stocks?

 
Vladimir Karputov:

Slava, can you comment: on the stock, the tick price in the symbol specification is set to '0'. And this is what support says:

"Received confirmation from the technical department. Please be advised that it is not possible to fill in the 'Tick price' parameter for the stock. The value will be defaulted to 0.
Thank you for contacting us!"


Is this really the case? It is in the Symbol Specifics that the tick price is zero just for stocks?

Yes. There are nuances.

When zero is exhibited, you have to do the math yourself. Ask your broker about the formula

 
fxsaber:

The problem of getting LATE ticks without skips is now only solved via CopyTicks*. This is a very cumbersome mechanism for this widespread problem.

By the way, from today's fresh logs from the latest release version of MT5:

Time[Main.mqh 162 in ProcessTicks: CopyTicksRange(_Symbol,OldTicks,COPY_TICKS_INFO,LastTickParsed.time_msc)] = 704931 mcs.
Time[Main.mqh 162 in ProcessTicks: CopyTicksRange(_Symbol,OldTicks,COPY_TICKS_INFO,LastTickParsed.time_msc)] = 704684 mcs.
Time[Main.mqh 162 in ProcessTicks: CopyTicksRange(_Symbol,OldTicks,COPY_TICKS_INFO,LastTickParsed.time_msc)] = 704425 mcs.

It was hanging 3 EAs on 1 symbol, each on its own chart. And the request goes on every tick. Such spikes are of course infrequent, but in fact 1 request for new ticks, coming from the last tick, was 700 ms.

 
Renat Fatkhullin:

It is not.

You will always catch random delays anywhere in any programme. Start keeping track of everything and you will be horrified at the realities of Windows. I have already explained this in detail several times.

At one time we too were astonished when we caught random bursts of 60-80 ms instead of 0 ms on system WinAPI functions.


We are now migrating most of our Windows solutions en masse to specially degreased Windows Server 2019 Core versions, and .NET Core web projects to Linux. This brings tremendous savings in system resources and seriously reduces system latency.

The first step in skimming the MataTrader 5 terminals was to start implementing a task manager to keep track of resource consumption on the fly. For ourselves, we are collecting more information.

It has already been revealed that we:

  • excessively long withholding unnecessary flows
  • over-scaling
  • Overextending caches.
By the next release we will fix some resource issues step by step.

Wouldn't it be nice to have a linux terminal as well )))

 
Slava:

Yes. There are nuances.

If you have zero, you have to calculate it yourself. Ask your broker for the formula.

Everything is correct with SymbolInfoXXXX. The question was why they say that '0' is set for shares in the Specification. They say it's clear - one tick equals one cent. But it is not the reason to set '0' in the Specification?

 
fxsaber:

Inside the function, you still have to jump to the corresponding tick character. This is the time to analyze the string variable. There is no need to do this with NULL.

I checked it at that time and did not see any significant speed difference. You may check it yourself

 
Slava:

If a normal string parameter is specified instead of Symbol(), _Symbol or NULL, then the full program is checked and properties are queried as well

Thanks for the info! It turns out it's better to do it this way:

// Быстрый SymbolInfoTick.
bool SymbolInfoTickFast( const string &Symb, MqlTick &Tick )
{
  return((Symb == _Symbol) ? SymbolInfoTick(_Symbol, Tick)
                           : SymbolInfoTick(Symb, Tick));
}
 
fxsaber:

Thank you for the information! It turns out that it's better to do it this way:

Even without technical details, I couldn't imagine how you could do it differently in your functions...

How should this construction be faster than the standard SymbolInfoTick()?

 
Artyom Trishkin:

How is this construction supposed to be faster than the standard SymbolInfoTick()?

Faster.