Errors, bugs, questions - page 2588

 
Aleksey Vyazmikin:

I still don't understand - do you have predictors that require more depth calculation? I do need one - MA on the daily chart :) I'm just running testing a year early and trading before that date can be banned...

Yes - depth of history is needed for more than a year. The solution has already been found. Now I'll also be doing a 3 year early launch and skipping them.
 
The KB does not pass the code. It gives these errors
MQL5\Include\fxsaber\BestInterval\Deal.mqh(10,32) : error 239: '::' - syntax error
MQL5\Include\fxsaber\BestInterval\Deal.mqh(10,34) : error 279: 'ToNull' - call non-const method for constant object
MQL5\Include\fxsaber\BestInterval\Deal.mqh(10,34) : error 279: 'ToNull' - call non-const method for constant object
MQL5\Include\fxsaber\BestInterval\BestInterval.mqh(202,32) : error 239: '::' - syntax error
MQL5\Include\fxsaber\BestInterval\BestInterval.mqh(202,34) : error 351: 'ToNull' - access to non-static member or function
MQL5\Include\fxsaber\BestInterval\BestInterval.mqh(214,32) : error 239: '::' - syntax error
MQL5\Include\fxsaber\BestInterval\BestInterval.mqh(214,34) : error 351: 'ToNull' - access to non-static member or function
MQL5\Include\fxsaber\BestInterval\BestInterval.mqh(225,32) : error 239: '::' - syntax error
MQL5\Include\fxsaber\BestInterval\BestInterval.mqh(225,34) : error 351: 'ToNull' - access to non-static member or function
MQL5\Include\fxsaber\BestInterval\BestInterval.mqh(416,33) : error 239: '::' - syntax error
MQL5\Include\fxsaber\BestInterval\BestInterval.mqh(416,35) : error 351: 'ToNull' - access to non-static member or function
MQL5\Include\fxsaber\BestInterval\BestInterval.mqh(435,33) : error 239: '::' - syntax error
MQL5\Include\fxsaber\BestInterval\BestInterval.mqh(435,35) : error 351: 'ToNull' - access to non-static member or function

Please update the KB compiler.

 
Vladimir Simakov:
When I'll be back from holiday, if it will not be too much trouble, I will study the question. But logically the bug may be in your code and not in mql.
By the way, just for fun, what if you have a library that works with what coding? Are you sure that utf-16, but what if it's utf-8, after all, the most common.

I haven't checked that yet, thanks for the tip. I'll dig in that direction.
The library is for Ocean, the classes I'm working with are selected with a W, i.e. Unicode.

As I understand the encoding.

const char *Utf8;
const char *Ansi;
const wchar_t *Utf16;
const wchar_t *Utf32;

utf-16 implies type wchar_t, the library function reading the string returns const wchar_t*
From this it becomes clear that the function returns a pointer to the string in utf-16 encoding
In the project properties, the Unicode character support is also selected.
The mql documentation says that string works in Unicode.

 

I'm optimising again, I'm not sure if I'll be able to test the execution speed of this code:

void OnStart()
{  datetime m_stoptime = 0;
//1.
   if(m_stoptime < TimeCurrent())
   {
      //расчеты   
   }


//2.
   MqlTick last_tick;
   if(SymbolInfoTick(_Symbol, last_tick))
   {  if(m_stoptime < last_tick.time) 
      {
         //расчеты
      }
   }

}

I suspect that variant 2 will be faster?

if so, where can be the pitfalls - I use in OnTick() - to search in the optimizer trade time, looking for ways to optimize the code


HH: I can ask how to check the speed options number 1 and number 2, it is very likely that the compiler will optimize the executable code and tests will not be correct - so I ask

 
Igor Makanu:

I can ask how to check variants 1 and 2 in terms of speed, there is a high probability that the compiler optimizes executable code and the tests will not be correct - so I ask

Run the usual test separately for 1 and 2 and compare times? )

If time is negligible, run the same optimization with option 1 and option 2.

 
Igor Makanu:

HH: I can ask how to test variants #1 and #2 on speed, it's highly probable that the compiler will optimise executable code and tests will not be correct - that's why I ask

https://www.mql5.com/ru/code/18804

TesterBenchmark
TesterBenchmark
  • www.mql5.com
При написании разных версий кода может возникнуть необходимость измерения влияния их на общую производительность советника в тестере. Это позволяет не только понять, насколько оптимален написанный код по сравнению с другим, но и дает предпосылки к будущей быстрой оптимизации советника. Такой подход позволяет выявить "бутылочное горлышко" в...
 
Igor Makanu:

I'm optimising again, I'm not sure if I'll be able to test the execution speed of this code:

I suspect that variant 2 will run faster?

if so, where can be the pitfalls - I use in OnTick() - to find in the optimizer trade time, looking for ways to optimize the code


ZS: I can ask how to check the speed options number 1 and number 2, it is very likely that the compiler will optimize the executable code and tests will not be correct - so I ask

Check in debug mode. The compiler isn't supposed to optimize there, although I don't know how it really works.
 

Question on ArrayResize. I make a Reserve for several gigabytes at once. Then I gradually increase Size which is less than initial Reserve.

Why does TaskManager show increase of memory consumption during Size increase?

 
fxsaber:

Question on ArrayResize. I make a Reserve for several gigabytes at once. Then I gradually increase Size which is less than initial Reserve.

Why does TaskManager show increase of memory consumption during Size increase?

Because besides metatrader there is Windows OS, which ultimately decides, which of dozens of processes (by the way, each of them has 4 GB of address space by default) really should be allocated RAM (how much RAM do you have there?).
 
Andrey Khatimlianskii:

Run a normal test separately for 1 and 2 and compare times? )

If time is negligible, run the same optimisation with variant 1 and variant 2.

I am doing something wrong, still could not see the difference, the results float around 0.1 sec on single run