![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
I think that only you, Dima, were talking about "it" here )
People were discussing working code in which if is the fastest part.
Switch works almost instantly, you can use it for universal EA. But I don't see the point.
It started from here.
Better not a switch, but OOP polymorphism.
We put a 40 kg weight on a donkey, then we notice that we forgot a 1 kg weight flask, it's not a problem, we put a 1 kg weight less - it's not a problem either. Thus you can put an endless load of one kilogram each on a donkey (such an insignificant thing for a donkey).
No credit.
They hang 20 grams of empty flasks on a donkey. And he really doesn't care.
It's hard on him from the water being poured in there (heavy functions).
It started from here.
Better not a sweep, but an OOP polymorphism.
In that particular example you can insert at least 10 ifs and it won't affect the speed of operation (as well as testing and optimization speed) (<1% slowdown).
Because in the adjacent function there will be parsing of orders or at least requesting of OrdersTotal, and the other function will be checking of time taking into account the shift of GMT.
...
In our example, you can insert at least 10 ifs and it won't affect the speed of operation (as well as testing and optimization speed) (<1% slowdown).
The reason is that the adjacent function will enumerate orders or at least orderTotal request, and the other function will check the time taking into account the shift of GMT.
Insert in that place, insert in another, insert in another, etc... and the donkey takes off.
The expediency of additional checking in that example is minimal. Someone wants, on the contrary, that the order is opened right after the EA is launched, even if the EA is working on bars. But our Expert Advisor is a super competent one in defining the shit code and everything that is wrong in his opinion is a shit code.
You're explaining everything to me like that, as if I haven't seen a single EA I haven't written. It turns out I don't even know how to write an if condition correctly.
It's not hard for a donkey, you don't pour water into flasks all at once, but one by one. It's proven that a donkey can be loaded with an infinite amount of weight.
I should not have started with my own cleverness:
Forum on trading, automated trading systems and trading strategy testing
Help!
Dmitry Fedoseev, 2015.11.03 20:44
The speed of operation is reduced.We just picked up on it! ;)
Stop it already. The fastest program is one OnTick(); and that's it.
Anything containing more code will be slower. And if you have to think about speed, it's certainly not about if.
An if can be crucial in OpenCL code where it creates branching logic leading to threads unsynchronization. But again, it is not if itself that is causing the slowdown, but the fact that threads work at different speeds due to different logics. Even in this case you should not try to reduce the number of ifs but "unify" operations in if and else blocks, e.g:
instead of
need to use
then the number of operations in different threads is preserved and there is no desynchronization and execution speed is higher, although there is more code.
Put in one place, put in another, put in another and so on... and the donkey will take off.
The expediency of additional checking in that example is minimal. Someone wants, on the contrary, that the order is opened right after the EA is launched, even if the EA is working on bars. But our Expert Advisor is super-authoritative by definition 00000 and everything that is not like it is xxxxxx.
You all are explaining it to me like that, as if I haven't seen a single EA, not that I have ever written one. It turns out I do not even know how to write the correct if condition.
They do not pour water into flasks all at once, but one by one. It's proved that the donkey can be loaded with infinite loads.
It is not only the program that can be carried to extremes. Which is exactly what you are doing.
If you say you know how, you must understand the principle of the if operator. Or don't you?
And do not compare an if operator with a donkey, a donkey sits in your brain and writes nonsense. And don't compare the if operator to a donkey sitting in his brain writing nonsense.
instead of
you should use