Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1108

 
Is it possible to check what values are used in the library, I tried the output to the file example above but it didn't work what can be used to simulate the print function in the library?
 

How do I transfer structures between MT4/5 terminals?


There are many ways to transfer.


But first you need to form some kind of string with data, which will then be read.


Question: how to transfer such structure?

struct STR_answer
  {
   int               full_total_real;
   int               remain_real;
   int               full_total_demo;
   int               remain_demo;
   string            Name;
   string            Full_name;
  };

There is a simple way, for example, to form a long data string like variable1 = value1, variable2 = value2.

But each structure must have its own string and its own parser.


Is there some other easy and universal way?

 
Sergey Likho:

How do I transfer structures between MT4/5 terminals?


There are many ways to transfer.


But first you need to form some kind of string with data, which will then be read.


Question: how to transfer such structure?

There is a simple way, for example, to form a long data string like variable1 = value1, variable2 = value2.

But each structure must have its own string and its own parser.


Is there some other easy and universal way?

It's much easier through a file. If you write a structure, you know its contents and can repeat the set of elements in the receiver. And then just FileWriteStruct and FileReadStruct
 
Sergey Likho:

How to transfer structures between MT4/5 terminals ?

Is there some other easy and universal way?

This is a universal solution,@fxsaber did it, he helped me to make a test example, it should work in MT4 and MT5 (MT5 checked - ok)

https://www.mql5.com/ru/forum/320395/page7#comment_12922647

If you understand it, you still need to solve the problem of data exchange between programs, in KB there is an example of file mapping without dll , although you can use file mapping if you do not often send the data

Каким вы видите Metatrader X в 2030 году?
Каким вы видите Metatrader X в 2030 году?
  • 2019.08.21
  • www.mql5.com
Что-то тут задумался, я на форе около 13 лет, начал с МТ4 в 2006 году...
 
Sergey Likho:

How do I transfer structures between MT4/5 terminals?

There are many ways to transfer.

Question: how to transfer such structure?

Here is an articlehttps://www.mql5.com/ru/articles/364 how to load a structure into RAM, the elements of the structure can be any data, if you understand it, you can tell someone something too.

It would be cool if it works in mt4 and maybe it does, I have no possibility to check it.

 

https://www.mql5.com/ru/forum/95447/page5


There are many cool examples of data conversion here and on the neighbouring pages.

I haven't yet found a universal solution on how to convert a string back to a structure

Библиотеки: TypeToBytes
Библиотеки: TypeToBytes
  • 2017.07.19
  • www.mql5.com
Статьи и техническая библиотека по автоматическому трейдингу: Библиотеки: TypeToBytes
 
Sergey Likho:

https://www.mql5.com/ru/forum/95447/page5


There are many cool examples of data conversion here and on the neighbouring pages.

I haven't yet found a universal solution on how to convert a string back to a structure

Why convert?
make a union and send what you need.

 

How to transfer structures. Solution


There are many ways to transfer data.

The question@fxsaber helped us with is how to make a string out of a structure, which can then be sent 1001 ways further.


Part 1 How to make a string from a structurehttps://www.mql5.com/ru/forum/95447/page5#comment_15687505

Part 2 How to make a structure from a stringhttps://www.mql5.com/ru/forum/95447/page5#comment_15688334

Библиотеки: TypeToBytes
Библиотеки: TypeToBytes
  • 2017.07.19
  • www.mql5.com
Статьи и техническая библиотека по автоматическому трейдингу: Библиотеки: TypeToBytes
 

Is it possible to save a pointer to an array as a variable in mql4/5?

Why can't I manage an array created in mql4 in C++? I tried to pass access to array's data but not to its references and pointer, as a result I can't resize or save the pointer for further use from outside application.

 
Sergey Likho:

How to pass structures.

An array of bytes. Strings are not needed.

Reason: