Asynchronous and multi-threaded programming in MQL - page 32

 
Реter Konow:

And how do you get the results of the calculations back?

In principle, it could write them to a resource, right?

And if you need to pass an array of data for calculations? Give it a command through OnChartEvent(), it will access the resource, read the data, perform the calculation, and then write the result to the resource?

But, anyway, the command can be given only through the EventChartCustom()?

And if we loop it after the first call, so that it would constantly call and read the resource and execute commands from it?

Sorry for the large number of questions. ))

You have an interesting time of experimentation ahead of you!

I delegate all the trading logic. I don't have to report the results, they may be accessed from anywhere in the terminal.

 
Andrey Barinov:

You have an interesting time of experimentation ahead of you!

I delegate all the trading logic. Its results do not need to be communicated anywhere in particular, they are already available from anywhere in the terminal.

Thank you for all your help. I have learned a lot of new things. I will be experimenting and will post the results in this thread. But it will not be fast, as I still have many tasks to solve beforehand.

I'm thinking like this. If when OBJ_CHART is started it is looped in to read the resource, then you can communicate with it further through it, and it will do all the tasks passed to it that the original that started it can do.


Added: the documentation says that the template cannot be placed in the EA as a resource. So there is a portability issue. But! the EA can create a template of itself when needed and further, load it and force its copy to perform only the required functions, communicating with it via resources after it is looped. I wonder if this option doesn't fail at any point, the multithreading issue can be closed.

 
Реter Konow:

Added: the documentation says that the template cannot be placed in the EA as a resource. So there is a portability issue. But! the EA can create a template of itself when needed and further, load it and force its copy to perform only the required functions, communicating with it via resources after it is looped. Interestingly, if this option doesn't fail at any point, the multithreading issue can be closed.

The template doesn't need to be migrated anywhere. It needs to be created once at the start of the main EA (as long as no agents are created)

 
Andrey Barinov:

The template does not need to be moved anywhere. It needs to be created once when starting the main EA (while no agents are created)

I meant the portability of programs using the templates. You can create a lot of templates with different functionality and run them, if necessary, from the main EA. However, such an EA has to be transferred together with all templates from computer to computer, because they cannot be placed in it.
 
Реter Konow:

Thank you for your help. I have learned a lot of new things. I will experiment and report the results in this thread. But, it won't be quick, as there are still a lot of tasks to be completed before that.

I'm thinking like this. If when OBJ_CHART is started it is looped in to read the resource, then you can communicate with it further through it, and it will do all the tasks passed to it that the original that started it can do.


Added: the documentation says that the template cannot be placed in the EA as a resource. So there is a portability issue. But! the EA can create a template of itself when needed and further, load it and force its copy to perform only the required functions, communicating with it via resources after it is looped. I wonder if this option doesn't fail at any point, the multithreading issue can be closed.

It's an interesting solution, but it's the lack of another full-fledged one.
Also, don't forget that using this approach, you can't create more than 98 threads!
Since the terminal will not allow you to open more than 99 charts. And this is already a limitation of possibilities.
For GUI programs where not so many threads are needed, the solution works well but it is not an option where more than 98 threads are needed.
Did anyone checked how much time it takes to launch the expert agent in this approach? When it creates a copy of a template, etc.
What is the cost time in this solution?

 
Roman:

It's an interesting solution, but it's the lack of another full-fledged one.
Also, don't forget that using this approach, you can't create more than 98 threads!
Since the terminal will not allow you to open more than 99 charts. And this is already a limitation of possibilities.
For GUI programs where not so many threads are needed, the solution works well but it is not an option where more than 98 threads are needed.
Did anyone checked how much time it takes to launch the Expert Advisor in this approach? When it creates a copy of a template, etc.
What is the cost time in this solution?

I agree. It is a crutch solution and even if all hopes for it are fulfilled, it is only available to me and a few other people who have developed inter-program technology. It will not work for others. Fact.
 
Roman:

Yes, it is an interesting solution, but it was created because of the lack of another full-fledged one.
Also remember, using this approach you cannot create more than 98 threads!
Since the terminal will not allow you to open more than 99 charts. And this is already a limitation of possibilities.
For GUI programs where not so many threads are needed, the solution works well but it is not an option where more than 98 threads are needed.
Did anyone checked how much time it takes to launch the expert agent in this approach? When it creates a copy of a template, etc.
What is the cost time in this solution?

You don't like everything, so you're on your own way to the dll. I left you links to the reference book with examples, did you look at it? Or did you miss it?

 
Vict:

You don't like everything, so you're on your own way to the dll. I left you links to the reference book with examples, did you see it? Or did you miss it?

You're ahead of me with the answer ) I'm just looking through it now, thanks for the links, it's the right one for C++ topic ))
And the fact that it's difficult or not, that's another matter, I have an understanding of what it is))
I like it all )) different approaches to understand, and then choose the one that makes more sense to me and meets the requirements, everything is simple.

 
Roman:

You're ahead of me with the answer ) I'm looking at them right now, thanks for the links, it's just what I need on the subject of C++ ))
And the fact that it's difficult or not, that's another matter, I have an understanding of what is future ))
I like it all )) different approaches to understand, and then choose the one that makes more sense to me, everything is simple.

ok, let me know if you need anything, we'll sketch out your euentloop, i think ))

 
Реter Konow:
It's a crutch solution

No, it's a good competence filter.

Reason: