Features of the mql5 language, subtleties and tricks - page 85

 
Nikolai Semko:

That's very interesting...
Do you have any idea why these things happen?

What is the mechanism?

It's hard to say exactly. When you know ahead of time that a variable won't change, you can find a more elegant way to store it, expose loops and other compiler optimizations.

So I would recommend using const as much as possible not only for self-checking, but for the compiler as well.

 
fxsaber:

It's hard to say for sure. When you know beforehand that the variable will not change, you can find a more elegant way of storing it, uncovering cycles and other compiler optimizations.

Therefore, I would recommend not only for self-monitoring, but also for the compiler to use const as much as possible.

Have you checked the other StringXXX functions? Maybe they are all slow: -D
 
Alain Verleyen:
Have you checked the other StringXXX functions? Maybe they are all slow: -D

I didn't. I needed it for that.

Скрипты: ThirdPartyTicks
Скрипты: ThirdPartyTicks
  • 2018.04.11
  • www.mql5.com
ThirdPartyTicks: Автор: fxsaber...
 

fxsaber:

void OnStart()
{  
  const string Str = "123.456";
  
  BENCH(Print(Bench1(1 e7, Str)));
  BENCH(Print(Bench2(1 e7, Str)));
  BENCH(Print(Bench3(1 e7, Str)));
}

Result(Release)

1234559999.924436
Time[Print(Bench1(1 e7,Str))] = 1656182
1234559999.924436
Time[Print(Bench2(1 e7,Str))] = 1639179
1234559999.924436
Time[Print(Bench3(1 e7,Str))] = 147382

In this form, these tests do not give entirely objective results because of the possibility of optimization of such code by the compiler. You have the same string parsed many times. And you need to parse different strings at each iteration

 
Alexey Navoykov:

As it is, these tests are not quite objective because of the compiler's ability to optimize such code. You have the same string being parsed multiple times, while you need to parse different strings at each iteration

I considered this circumstance but did not lay out heavier code. It has the same result.

 

Duplicated here, I think it got lost

Forum on trading, automated trading systems and strategy tester

FAQ from Beginners MQL5 MT5 MetaTrader 5

Vitaly Muzichenko, 2018.04.18 14:54

Can you tell me, after the test in multicurrency mode in the tester we see the result only ..., however, we do not see anything but the overall result.

Somewhere I met either in an article or in kodobase a code that shows the results for each symbol separately. Who knows what about it?

 
Vitaly Muzichenko:

I'll duplicate it here, it must have got lost there

https://www.mql5.com/ru/articles/4562

Работаем с результатами оптимизации через графический интерфейс
Работаем с результатами оптимизации через графический интерфейс
  • 2018.04.05
  • Anatoli Kazharski
  • www.mql5.com
Продолжаем развивать тему обработки и анализа результатов оптимизации. В предыдущей статье было показано, как визуализировать результаты оптимизации через графический интерфейс MQL5-приложения. На этот раз усложним задачу: выберем  100 лучших результатов оптимизации и отобразим их в таблице графического интерфейса.  Кроме этого, продолжим...
 

I found this, but it's a little different.

Thank you!

 

Forum on trading, automated trading systems and trading strategies testing

Released beta version of MetaTrader 5 build 1795 on MetaQuotes-Demo

fxsaber, 2018.04.24 09:37

Tester
TESTER_EURUSD : real ticks begin from 2018.04.02 00:00:00
TESTER_EURUSD : 2018.04.03 00:00 - 2018.04.24 00:00  last prices absent for 15 whole days, bars built by bid prices
final balance 10000000.00 USD
OnTester result 203343
TESTER_EURUSD,M1: 1407448 ticks, 21591 bars generated. Environment synchronized in 0:00:00.172. Test passed in 0:00:00.905 (including ticks preprocessing 0:00:00.203).


What does last-price have to do with a symbol with these settings?

You need to zero out SYMBOL_TICKS_BOOKDEPTH, otherwise (in the screenshot = 9) Tester will expect last-price (even if there is none) as above in the post.

So after "Copy from:" keep an eye on this parameter.
 
I saw it in SB, didn't know about it.
template <typename T>
struct TMP
{
  T Tmp;
};

TMP<int>Var; // Между типом и названием переменной нет пробела