MT5 and speed in action - page 90

 

Forum on trading, automated trading systems and trading strategy testing

MT5 and Speed in Action

fxsaber, 2021.03.10 14:53

A clear example of what slows down the Market Watch.

Look at the values in the Processor column (second from the right).


Maybe Market Overview should be handled by the video card?

 
BillionerClub:

Maybe the market overview should be handled by the video card?

Especially if the MT is in a virtual machine (not an uncommon case).

 
BillionerClub:

Maybe the market overview should be handled by the video card?

There is no FPS (Frames per Second) limit in the Terminal. In Market Watch it can be 300 fps or higher.

Any visualisation in trading terminals at fps > 50 is a waste of computing resources.

 
BillionerClub:

Maybe the market overview should be handled by the video card?

rather be not based on SysListView32, which is not fast in itself, but to have its own element for rendering, but with all the "charms" of implementing scrolling, sorting, etc. Another question - is it so necessary when working in this form? and then turning it off for the period of work would be an option to fix this problem (if it is a problem)

 
Found missing property cache for graphical objects.
#include <fxsaber\Benchmark\Benchmark.mqh> // https://www.mql5.com/ru/code/31279

void OnStart()
{
  const string Name = "ObjectName";
  
  ObjectCreate(0, Name, OBJ_BITMAP_LABEL, 0, 0, 0);
  
  for (int i = 0; i < 10; i++)
    _B(::ObjectGetInteger(0, Name, OBJPROP_COLOR), 100); // Повторное обращение к тому же объекту должно быть быстрым, но этого не происходит.
    
  ObjectDelete(0, Name);
  
  Print(::ObjectSetInteger(0, Name, OBJPROP_COLOR, 0)); // true для удаленного объекта!
}


Result.

Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 555 in OnStart: ::ObjectGetInteger(0,Name,OBJPROP_COLOR)] = 9361 mcs.
Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 555 in OnStart: ::ObjectGetInteger(0,Name,OBJPROP_COLOR)] = 396 mcs.
Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 555 in OnStart: ::ObjectGetInteger(0,Name,OBJPROP_COLOR)] = 1399 mcs.
Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 555 in OnStart: ::ObjectGetInteger(0,Name,OBJPROP_COLOR)] = 987 mcs.
Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 555 in OnStart: ::ObjectGetInteger(0,Name,OBJPROP_COLOR)] = 1111 mcs.
Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 555 in OnStart: ::ObjectGetInteger(0,Name,OBJPROP_COLOR)] = 1040 mcs.
Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 555 in OnStart: ::ObjectGetInteger(0,Name,OBJPROP_COLOR)] = 639 mcs.
Alert: Bench_Stack = 0, 100 <= Time[Test9.mq5 555 in OnStart: ::ObjectGetInteger(0,Name,OBJPROP_COLOR)] = 796 mcs.
true


Very expensive. And an ObjectSet function error as well.

Search string: Oshibka 026.

 
fxsaber:

And an ObjectSet function error as well.

Search string: Oshibka 026.

Object handling asynchronous

 
Andrey Khatimlianskii:

Object handling is asynchronous

It turns out that ObjectSet always has to return true.

 
fxsaber:

It turns out that ObjectSet always has to return true.

Read the help:

https://www.mql5.com/ru/docs/objects/objectsetinteger

Returned value

Returns true only if command to change graphic object's properties was successfully sent to graphic, otherwise returns false. To get more information about the error, call GetLastError().


Документация по MQL5: Графические объекты / ObjectSetInteger
Документация по MQL5: Графические объекты / ObjectSetInteger
  • www.mql5.com
ObjectSetInteger - Графические объекты - Справочник MQL5 - Справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
fxsaber:

It turns out that ObjectSet always has to return true.

I can't reach the same conclusion using logic.

 
Andrey Khatimlianskii:

Anton:

false - only if wrong with ChartID. With own ChartID (zero) it's always true.

You have to try very hard to cause false.