Help! - page 6

 
They put a 40kg pack on a donkey, then they noticed that they forgot a flask weighing 1kg - it's not a problem, it's more than 1kg less, so they put the flask on the donkey as well. So putting one kilo each on a donkey (such an insignificant thing for a donkey) it can be loaded with loads of infinite size.
 
Andrey Khatimlianskii:

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.

 
Dmitry Fedoseev:
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).

Dmitry Fedoseev:

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.

 
Andrey Khatimlianskii:

...

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.

 
Dmitry Fedoseev:

I should not have started with my own cleverness:

We just picked up on it! ;)

 
Reduces and therefore there is no reason to shove if where you can do without 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

if(a>0.0)
  a = b;

need to use

if(a>0.0)
  a = b;
else
  a = a;

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.

 
Dmitry Fedoseev:

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.

 
Cram your favourite ifes in wherever you like
 
Joo Zepper:

instead of

you should use


Why not the other way round?