Discussion of article "DIY multi-threaded asynchronous MQL5 WebRequest" - page 5

 

Tried with firewall and defender disabled - same result.

Win 10 Home. No antivirus, because I am "picky about connections"

 

Good afternoon,

The article is very interesting.

If I may throw my pebble....

Due to the introduction of a large number of calendar functions by developers, http request becomes less demanded (I don't think that other data request was widely used). I am primarily interested in the possibility of running the optimisation algorithm in parallel (periodically, by drawdown parameter, etc., it doesn't matter).

If possible, could you answer whether such a mechanism (with execution in a separate thread) is possible on Services?

Regards to the work done by the author

 
Олег Миронов:

Due to the introduction of a large number of calendar functions by developers, http request becomes less demanded (I don't think that other data request was widely used). I was primarily interested in the possibility to run the optimisation algorithm in parallel (periodically, by drawdown parameter, etc., it doesn't matter).

If possible, could you answer whether such a mechanism (with execution in a separate thread) is possible on Services?

The built-in calendar is quite generic, so there is still a lot of useful profile information to download from third-party sources. Moreover, it is not only news, but also signals, quotes from cryptocurrency exchanges and so on. There is an idea about using parallel threads for calculations instead of web requests, but it has not been implemented yet. But I don't understand about services. Do you mean services as MQL5 programmes? MQ has not provided any two-way communication with other programmes for them (it is impossible to send a "task" for calculation and get the result). So these services are excluded.

 

Posted to the codebase an example of an indicator that requests long parallel calculations in expert calculators, which are automatically placed in chart objects on the current chart (window).

The indicator without buffers is only to demonstrate the possibility of requesting heavy calculations in other threads. From Expert Advisors it is certainly possible to do it this way too. To implement it, you need to write your own packers and unpackers of parameters both on the side of the calling MQL-program and the expert-calculator.

Code Base

Pseudo-Indicator with Asynchronous Multi-Threaded Calculations Demo

Stanislav Korotky, 2020.01.16 20:13

This is an indicator w/o buffers which demonstrates parallel multi-threaded calculations in chart objects hosting worker expert adviser.

Examples of logs

4 tasks on 1 core:

4 tasks execution on 1 core (thread)

4 tasks on 2 cores (2 times faster):

4 tasks execution on cores (threads)

 
Stanislav Korotky:

Posted to the codebase an example of an indicator that requests long parallel calculations in Expert Advisors, which are automatically placed in chart objects on the current chart (window).

The indicator without buffers is only to demonstrate the possibility of requesting heavy calculations in other threads. From Expert Advisors it is certainly possible to do it this way too. To implement it, you need to write your own packers and unpackers of parameters both on the side of the calling MQL-program and the expert-calculator.


and then that indicator is also poked by EA :-)

 

When starting the terminal, the Expert Advisor checks for the presence of a global variable on the chart and, if it is absent, creates it and sets its number. Chart clients send messages to the chart manager.

Then the user closes the chart manager window. Clients send requests to a window that no longer exists.

In other words, the article ignores the problem of changing the chart manager. That is, it is only necessary to close the chart manager and the whole scheme collapses.

 
Алексей Барбашин:

When starting the terminal, the Expert Advisor checks for the presence of a global variable on the chart and, if it is absent, creates it and sets its number. Chart clients send messages to the chart manager.

Then the user closes the chart manager window. Clients send requests to a window that no longer exists.

In other words, the article neglected the problem of changing the chart manager. That is, it is only necessary to close the chart manager and the whole scheme collapses.

The article proposes a technology and its minimal implementation. Checking for all possible problem situations was beyond the scope of the article. Clients can check the existence of a chart by its ID (available via pool.getManagerID). All source code is open source.

Please note that in the process of developing the idea presented in the article, a scheme of simplified multithreaded query processing using objects was developed. There the mentioned problem is not "by design". The sources are also attached in this thread. So it is recommended to use them.

 
Stanislav Korotky:

The article proposed the technology and its minimal implementation. Checking for all possible problem situations was beyond the scope of the article. Clients can check the existence of a chart by its ID (available via pool.getManagerID). All source codes are open source.

Please note that in the process of developing the idea presented in the article, a scheme of simplified multithreaded query processing using objects was developed. There the mentioned problem is not "by design". The sources are also attached in this thread. So it is recommended to use them.

I saw the development of the topic )) But unfortunately the use of objects "chart" is available, as it was indicated, only in MT5.

 
Stanislav Korotky:

The built-in calendar is quite general, so there is still a lot of useful profile information to download from third-party sources. Moreover, it's not only news, but also signals, and quotes from cryptocurrency exchanges, etc. There is an idea about using parallel threads for calculations instead of web requests, but it has not been implemented yet. But I don't understand about services. Do you mean services as MQL5 programmes? MQ has not provided any two-way communication with other programmes for them (it is impossible to send a "task" for calculation and get the result). So these services are excluded.

Thank you. You have understood everything correctly about the services. Expert calculators were the direct answer. Extremely interesting. Thanks again.
 
What should be the offset (input int MessageBroadcast) for user events if UI elements from the standard library(Include\Controls\) are used in the programme? How can I find out?