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
thanks all for your input.
What is an "heavy processing" for you ? Did you decide it's heavy subjectively or do you come to this conclusion in practice ?
The best approach remains one multi-symbols EA. And they, if needed (but I am curious to "see" if it is really) you can delegate subtask/processing using indicators, EAs or even services.
kinda new to MT5/mql5 ....so you're saying the multi-sym EA can call other EAs/indicators to offload the main thread and those "helper" EAs/indicators would get assigned their own threads/cores ? how to do this? spill dem beans !
One thing I can suggest is to [try to] use fxsaber's Virtual library in all separate EA's, then just implement a way to transfer/scan/report periodically these virtual environments into the single master EA, which will decide which parts of the virtual trades to copy into the real world.
seems rather complicated.
There are none by MetaQuotes (with a caveat, see below). MetaTrader has never had a proper IPC and I doubt there will be any in the foreseeable future. It is simply not part of the platform's architecture.
The only method (the caveat) that comes close to a type of IPC implementation described by MetaQuotes is the Custom Chart Events but it's limited, rudimentary and suffers from all the same issues that chart events suffer from, and only Indicators and EAs can process the events. Scripts and Services cannot.
There have been a few articles by normal users, describing their own personal solutions for IPC, but there is no consensus among them.
yup...custom events was one of the early ideas ...though i am not sure how it will help to have multiple EAs calling the same event handler simultanously ....which is the main the issue.
I would go with Fernando's first listed idea in his Post #2... GV's (terminal-wide) GlobalVariable's. They're basically double type variables with custom string type names. I would encapsulate each EA's trade entry conditions within a parent condition that detects via GV whether a preempting (prioritized) EA is already in a trade. The master EA would update its master GV following its entry and exit of a trade. EA2 would check the master GV value in a condition that encapsulates EA2's trade entry logic (and update EA2's own GV value following order execution), and EA3 would check both the master GV and EA1's GV values (and update).
If you choose to go this route and you haven't worked with GV's before, they are rather unique. They stay in MT5's memory until you manually or programmatically delete them, even after you shutdown MT5. You can inspect and alter them in the Tools ==> Global Variables window.
yup..read up on them...they're neat for sure ....and will come in handy ....but again...they don't address the fundamental challenge: if two or more EAs want to open a trade at once ...even a global terminal var locking mechanism won't help and might actually run into race conditions due to processing synchronicity
No, it is not the same event handler. Each program (EA or Indicator) has their own independent event handler.
You are using "jargon", but not really understanding the concepts. If it is using a locking mechanism, like a mutex for exemple, how can there be a race condition?
The whole point of using a locking mechanism is to prevent the race condition in the first place.
You are using "jargon", but not really understanding the concepts. If it is using a locking mechanism, like a mutex for exemple, how can there be a race condition?
The whole point of using a locking mechanism is to prevent the race condition in the first place.
yeah..well ...i don't do coding for a living so there is that.
in your previous post you mentioned that the EAs should access unique event handlers ....but how do you establish a "central controller" mechanism using a priority list by handling the EAs requests through independent/unique event handlers ?
don't you need ALL requests to go to the SAME event handler....the event handler would then refer to the priority list and issue trade authorization to the highest priority EA.
how can we do this using multiple event handlers....not sure how that would work ? how to implement this ?
You are overthinking, overcomplicating and mainly prematurely thinking about optimization.
Code your multi-symbols EA, calling your indicators, and you could be really surprised how fast is MQL5 (if well coded).
yeah..well ...i don't do coding for a living so there is that.
in your previous post you mentioned that the EAs should access unique event handlers ....but how do you establish a "central controller" mechanism using a priority list by handling the EAs requests through independent/unique event handlers ?
don't you need ALL requests to go to the SAME event handler....the event handler would then refer to the priority list and issue trade authorization to the highest priority EA.
how can we do this using multiple event handlers....not sure how that would work ? how to implement this ?
Your questions give an ambiguous impression of your knowledge. On one hand you use the words/jargon as if you understand the concepts, but at the same time it also seems you don't understand them.
So without a common understanding of the words/jargon, how are we going to communicate and give you the correct advice?
I personally am of the opinion that you need to streamline your code, and make it efficient enough to have only a single EA to do everything. Strategies that are too complex and require too much processing are usually a sign of a losing strategy. Refining it will help reduce the points of possible failure in the strategy rules.
Regarding the use of Global Terminal Variables, @William Roeder has in the past shared his Mutex implementation. This is one way to synchronise the exchange of data between different programs.
Your questions give an ambiguous impression of your knowledge. On one hand you use the words/jargon as if you understand the concepts, but at the same time it also seems you don't understand them.
So without a common understanding of the words/jargon, how are we going to communicate and give you the correct advice?
I personally am of the opinion that you need to streamline your code, and make it efficient enough to have only a single EA to do everything. Strategies that are too complex and require too much processing are usually a sign of a losing strategy. Refining it will help reduce the points of possible failure in the strategy rules.
Regarding the use of Global Terminal Variables, @William Roeder has in the past shared his Mutex implementation. This is one way to synchronise the exchange of data between different programs.
is this supposed to compile in mt5 without the basic_types.mqh include file? where to get that?
It is supposed to serve as an example for you to study and develop your own version, not to be used without regard for understanding it first.
[T]hey don't address the fundamental challenge: if two or more EAs want to open a trade at once ...even a global terminal var locking mechanism won't help and might actually run into race conditions due to processing synchronicity
I assume that your code would also be limiting the number of trades with something like PositionsTotal() or deal status. If EA1 opened a trade, the trade count would equal 1 and the master GV would equal say, 2.0, representing "in-the-market." As EA2 would be conditional on the trade count being zero and EA1 being "out-of-the-market," EA2 wouldn't trade... and so on regarding EA3.
When I need values "set in stone" and accessible to multiple indicators and/or multiple EA's, I frequently use GV's. In this way, I've never experienced race conditions. The GV values simply update in sequence.
My pc has a 2019 Intel Core i7 processor. Nothing special. I have no idea what you're running, of course.