Asynchronous and multi-threaded programming in MQL - page 28
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Print, ASSERT, DEBUG. I don't use the in-house debugger in this case...
Yes, that's an inconvenience. Almost like in old MQL4.
And how does such "multithreading" correspond to its notion? Is it possible to split program tasks into threads using this function?
For certain tasks 100%. For example, you need to manage trades - Trawl or something else.
This task can be performed on the agent on every tick for as long as you like and the GUI will still work.
With this scheme, protections are made
What flag do you use to identify slave/master EA mode? If I use OBJ_CHART then it's a slave. And in MT4? My input was datetime, so I easily solved it using a negative datetime. But I haven't tried it without input.
For certain tasks 100%. For example, you need to manage trades - Trawl or something else.
This task can be performed on an agent on every tick for as long as you like and the GUI will still work.
With this scheme, protections are made
Yes, protection is needed, as always.
Files should be used wisely. Only when needed. Only moments of significant environment / state changes that the agent itself cannot recognize are synchronized.
The copycat is usually running on a VPS, so it's not really a big deal.
Copycats usually work on a VPS, so it's not too scary.
Poor VPS... above supplemented the question.
Still a dark forest. The function creates a saved copy of the chart and then, can I open a new chart from the EA and run the saved template on it, and in doing so, the copy of the EA will run on that chart?
1.The user places the EA on a blank chart.
2. The EA creates a template (with itself on the chart)
3. The Expert Advisor creates a new chart (OBJ_CHART or a normal chart in case of MT4)
4. The Expert Advisor applies the template to the new chart.
5. A copy of the EA starts on the new chart, now it should understand that this is the agent, not the main EA :)
6. They start communicating.
They live happily ever after and die on the same day :)
Poor VPS... above supplemented the question.
You can't make a copy without files (for the marketplace). And trading environment synchronisation files between terminals take much more operations than synchronisation between agents.
The agent in MT4 is determined by the presence of appropriate global variables which are set by the main EA before applying a template to a new chart.
Poor VPS... above supplemented the question.
You have to take into account that OS doesn't axe writes to disk, it knows how to cache. I can't remember where, but there's even a setting somewhere in wind.
1.The user places the EA on a blank chart.
2. The EA creates a template (with itself on the chart)
3. The Expert Advisor creates a new chart (OBJ_CHART or a normal chart in case of MT4)
4. The Expert Advisor applies the template to the new chart.
5. A copy of the EA starts on the new chart, now it should understand that this is the agent, not the main EA :)
6. They start communicating.
They live happily ever after and die on the same day :)
Cool!)) Thanks!
Yeah, that's the kind of multithreading. You need to run for each heavy task a copy of the EA on a separate chart via a template and tell that copy to only perform the function you want it to perform. The other functions of the copy can rest.
Will communication via resources with copies on regular charts (not OBJ_CHART) take place? Or are there any restrictions?