building trading system - a unified smart solution for simultaneous trading with different strategies - page 2
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
It's better to use OOP to prevent a mess in code. A lot of trading frameworks (with different complexity and capabilities) are already published on this site.
ohh, I guess I misunderstood the point of Your comment, I guess i just got the idea now...
Did you mean that the function void Check_Positions() could also defined only once not inside each strategy ?
I haven't thought about it myself as I've been testing and learning mql5 trading logic, but it's probably a good idea as the task of the function serves the same purpose in every strategy... I'll deal with it as soon as I have time.
I've now had a few hours to think about this topic. For easier management, it is of course a good idea to put such a function in its own responsible class so that we don't have to search for its location later, since we can do it with only a very small additional cost. At the same time let the variables of the each strategy be left processing to the strategy itself. Because each strategy is inherently very different. There is no point in bringing them higher, it would only create unjustified additional costs and additional confusion.
There is no point in making functions like this virtual or implementing it in any other way with deeper OOP principles. In this particular case, it would do more harm than good. I believe that the best thing to do to make a specific situation more comfortable would look something like this:
but my original question was much easier, whether it is still a good solution to use the PositionSelectByTicket() function to track active positions and whether this function can fail in certain situations? mql5 gurus know this for sure...