
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
Here we go.
Here's how we do it.
If static variable is initialized with constant, this initialization will be done at global initialization step, as before
Otherwise (call or variable initialization), static variable will be initialized at first call (it will be like in C++), this call itself will be wrapped in a condition with implicit global variable/flag, for example
for MQL code:
The following pseudocode will be generated
You still have to separate them somehow in the function.
Not necessarily and not always. I won't give you examples, so as not to litter the thread.
Here's what we're going to do.
Yes, approximately so. For MQL has no full-fledged OOP. Plus there are a lot of bugs, which I regularly report, but without success. And against the bugs I have to defend myself with crutches, what can I do.
You've got me all confused. If in ... read your words
Forum on trading, automated trading systems & strategy testing
Peculiarities of mql5, tips and tricks
Alexey Navoykov, 2019.01.25 11:44
If the parameters are of different types, it is reasonable to make several overloaded methods with the corresponding types. You have to share them in functions anyway, so it's better to divide them into separate functions, than to make a mess, which in addition takes anonymous type, ie you can mistakenly pass anything into it and get a compilation error inside the library, that is not good. Or may not even get, which is doubly bad.)
In short, in full-fledged OOP template functions are a crutch (with few exceptions).
MQL is OK with OOP, if they add multiple inheritance(at least for interfaces, because they are useless in their current form), it will be perfect.
So, interfaces are the basis of normal OOP, and you're saying that everything is fine in MQL.
So interfaces are the basis of normal OOP, and yet you say that everything is fine in MQL.
The basis of normal OOP is polymorphism, not interfaces. Interfaces are the basis of a certain class structure. In general, I would love to talk about these topics, but I'm afraid this thread is not the place for it.
The basis of normal OOP is polymorphism, not interfaces. Interfaces are the basis of a certain class structure. In general, I would be glad to discuss these topics, but I'm afraid this branch is not suitable for it.
We are discussing particularities of the MQL language and the absence of multiple inheritance is quite a characteristic feature).
Ok, the basis of course is polymorphism, but without separate interfaces it is not convenient in use. This often leads to passing objects as template arguments instead of interfaces.
I've described here my variant of simulating multiple interfaces. Accordingly, a class can be declared like this:
We are discussing peculiarities of MQL language and the absence of multiple inheritance is quite a peculiarity).
Ok, the basis of course is polymorphism, but without separate interfaces it's not convenient in use. This often leads to passing objects as template arguments instead of interfaces.
I've described my variant of imitating multiple interfaces here. Accordingly, a class can be declared as such:
In my opinion, it's not all bad. There are not so many basic main interfaces in C# that their methods could not be reduced to one basic superclass and then inherited.
P.S. To implement something multiple through constructions like <<<<>>>> is a bit of a pain in the ass. It is better to do functions through operators, e.g. a==b calls a.compareto( b ), a[comparer]==b calls comparer.compare(a,b), etc.