My approach. The core is the engine. - page 85

 

Talking about intuition. I want to give you an interesting example. My post, printed in this thread https://www.mql5.com/ru/forum/95632/page12more than two years ago:

Реter Konow:

1. The concept of a graphics engine.

2. Concept of the graphics core.

3. stages of creating the visual studio for the MT platform.

4. Description of the EA interface creation mechanism.


Thegraphical engine is a program designed as an indicator. This program is designed solely for management of the user interface. It executes a set of basic functions:

  • Loading the core of the graphical interface from a file.
  • Saving the custom settings of the interface.
  • Implementation of the unified and coordinated control of all processes in the interface. It implements the interface "mechanics" including: opening and closing windows, resizing windows, moving windows, merging windows, scaling, playing scripts, changing states of objects, binding objects, controlling values of parameters of controls according to their types and properties, creating and destroying global variables.

Graphical engine is added to a chart like any other indicator . It includes the following set of windows:

  • A taskbar, on the right side of which several icons will be added to call theservice windows of the engine itself.
  • A file navigator which will be used to select the boot file froma list of files with interfaces located in a special folder.
  • Optional settings windows, which do not play a crucial role at this stage.

This, in principle, is the end of the graphical engine concept. The important thing is that without it the interface operation is impossible.



A graphical engine is a block of information containing data of all objects and windows in an interface, which is recorded in an array and saved in a file.

This block is a digital representation of the graphical interface. It is loaded by the graphics engine at the request of the user. The graphics engine itself has its own, internal graphics kernel which ensures operation of its own windows, and free space is provided inside this kernel for integration of the user interface (in the digital form) into it. Integration is performed in the process of loading the graphical core from a file.


3. Creating a visual studio on the MT platform, as I understand it, is divided into two stages:

  • In the first stage, a file-based version of the interface builder will be created. In it, the user will work with table templates. In the tables, the user will write the types and names of interface elements and set properties of their parameters. Creation will be extremely easy for user, he won't have to worry about correct positioning of his elements in the windows (the engine will calculate everything automatically) and it will be enough just to arrange elements in required order.
  • In the second phase, a visual environment will be created that implements the same interface construction method as the file constructor, only it will be easier and more convenient to use. It will also add the ability to change the appearance of the controls. In general, the user will have more graphical options.


4. I would like to outline the mechanism of interface creation process and slightly lift the veil on its technology. Explain where the ease of creating an interface via a file comes from.

This is the case: the engine has a special function which creates a complete graphical kernel based on a single file with a minimum amount of loading information. Boot information in this file is self-explanatory and human-readable. It is easy to write and edit. For example you need to write "_CREATE_NEW_WINDOW" to create a window, and "_CHECKBOX" and name of checkbox, (engine automatically recognizes name of element, as name of element itself and as name of its parameter).

This function is called "G_CORE_BUILDER()" and it builds the graphical core by taking data from two main sources: a boot-up file created by the user and "CONTENT[]" array containing all standard groups of objects included in windows and controls platforms. " CONTENT[]" also contains states and scripts of objects. Everything in one array. In general, the source material from "CONTENT[]" + the loader file created by the user is used by "G_CORE_BUILDER()" to build the graphical core with which the engine works.

Приход нового поколения торговых программ. Каким должен стать интерфейс советников?
Приход нового поколения торговых программ. Каким должен стать интерфейс советников?
  • 2016.09.19
  • www.mql5.com
Уважаемые разработчики, в преддверии скачка развития торговых программ, ожидается что создаваемые нами роботы преобретут массу новых возможностей...
 

It's amazing how much the terms and concepts have NOT changed in two years of hard work. And functions and arrays and keywords are as it says here. Everything has been implemented according to this scenario. And this technology is working and evolving, despite thefact that two years ago, I had NO experience in developing a markup language at all.

I didn't reach a dead end, I didn't change the concept, I didn't change the direction. I continued to create the engine, the core and the markup language exactly as I originally intended. And practice confirms that the path I chose was the right one.

If this is not prophetic intuition, then what is?

 

Dear opponents.

Here is the script code which:

  1. Measures the time of transferring a string to a Char array, for passing the string to another program via a resource and the time of retrieving a string from a Char array for subsequent splitting and retrieval of information.
  2. Measures the time to write the string to the MT object description and the time to retrieve the string from the MT object description, for subsequent splitting and retrieval of information.
//+------------------------------------------------------------------+
//|                        CharArrayToString и StringToCharArray.mq4 |
//|                                                      Peter Konow |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Peter Konow"
#property link      "https://www.mql5.com"
#property version   "1.00"
//--------------------------------------------

//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   string qwerty = "qierfhqoerifhqoiwerufhqoiwerfhwioefhqowasdkfj";   
   uchar Arr[];
   //---------------------------------
   //Создаем объект связи.
   //---------------------------------
   ObjectCreate(0,"button_1",OBJ_BUTTON,0,0,0);   
   //---------------------------------
   ulong t1 = GetMicrosecondCount();
   //---------------------------------
   //Переводим строку в тип Char
   //---------------------------------
   StringToCharArray(qwerty,Arr,0,WHOLE_ARRAY);
   //---------------------------------
   ulong t2 = GetMicrosecondCount();
   //---------------------------------
   //Переводим массив Char обратно в строку:
   //---------------------------------
   string str_1 = CharArrayToString(Arr,0,WHOLE_ARRAY);
   //---------------------------------
   ulong t3 = GetMicrosecondCount();
   //---------------------------------
   //Записываем строку в описании МТ-объекта.
   //---------------------------------
   ObjectSetString(0,"button_1",OBJPROP_TEXT,"qierfhqoerifhqoiwerufhqoiwerfhwioefhqowasdkfj");
   ulong t4 = GetMicrosecondCount();
   //---------------------------------
   //Cчитываем строку из описания МТ-объекта.
   //---------------------------------
   string str_2 = ObjectGetString(0,"button_1",OBJPROP_TEXT);
   ulong t5 = GetMicrosecondCount();
   //---------------------------------   
   //Замеряем время исполнения.
   //----------------------------------------------
   Print("Time of execution StringToCharArray:   ",t2-t1);
   Print("Time of execution CharArrayToString:   ",t3-t2," строка от CharArrayToString:  ",str_1);
   //----------------------------------------------
   Print("Time of execution ObjectSetString:     ",t4-t3);
   Print("Time of execution ObjectGetString:     ",t5-t4," строка от ObjectGetString:  ",str_2);
   //----------------------------------------------
  }
//+------------------------------------------------------------------+

Result:

2018.12.18 16:44:20.042 CharArrayToString и StringToCharArray GBPUSD,M5: Time of execution StringToCharArray:   47
2018.12.18 16:44:20.042 CharArrayToString и StringToCharArray GBPUSD,M5: Time of execution CharArrayToString:   35 строка от CharArrayToString:  qierfhqoerifhqoiwerufhqoiwerfhwioefhqowasdkfj

2018.12.18 16:44:20.042 CharArrayToString и StringToCharArray GBPUSD,M5: Time of execution ObjectSetString:     3
2018.12.18 16:44:20.042 CharArrayToString и StringToCharArray GBPUSD,M5: Time of execution ObjectGetString:     3 строка от ObjectGetString:  qierfhqoerifhqoiwerufhqoiwerfhwioefhqowasdkfj


 

My solution is more than 10 times faster.

Add to your solution, the time to save the resource and the time to get the resource into the array using ResourceReadImage();

In my solution, neither the first nor the second is required.

 
Реter Konow:
My solution is more than 10 times faster.

Peter, if you work with string, you will lose performance in any case. So it's surprising to hear you chasing a mythical performance, even though you originally chose an unsuitable solution for it: passing messages through a string and then parsing that message.

 
Vasiliy Sokolov:

Peter, if you work with string, you will lose performance in any case. So it's surprising to hear you chasing mythical performance, even though you originally chose an unsuitable solution for it: passing messages through a string and then parsing that message.

Vasily, how else do you transfer data of all types between programs?

OnChartEvent() is partially suitable.

  1. It does not work in the tester.
  2. With a large number of calls - the event queue gets clogged.


 
And by the way, measurements less than 20 milliseconds are, strictly speaking, not valid at all, at least in preemptive multithreading systems. But even if you accept your result (in general I admit it), it still doesn't tell you anything, because it's the full-circle costs that matter. And what you have measured is only part of it.
 
Vasiliy Sokolov:
And by the way, measuring less than 20 milliseconds, strictly speaking is not valid at all, at least in systems with preemptive multithreading. But even if you accept your result (in general I admit it), it still doesn't tell you anything, because it's the full-circle costs that matter. And what you have measured is only part of it.

We need a universal and the fastest way. To work in the tester and to bypass the OnChartEvent() event queue;

The test shows that it's 10 times slower to transfer through the resources. (without measuring time for saving resource and getting data from itusing ResourceReadImage()) .

My solution is the best option under initial conditions.

 
Vasiliy Sokolov:
...But even if you accept your result (in general I admit it), it still doesn't tell you anything, because it's the full-circle costs that matter. And what you have measured is only part of it.

True, but if you extrapolate to more lines and gears, my option still wins.

 
Реter Konow:

Vasiliy, how else do you transfer data of all types between programs?

Direct mapping of structures via union to byte array, shared for global access. I don't know if this is technically feasible, but if so, the speed will be cosmic, because you won't have to copy anything at all.

Reason: