Alternative implementations of standard functions/approaches - page 2

 
Renat Fatkhullin:

By 2016, most C++ compilers have arrived at the same levels of optimisation.

MSVC makes one wonder about the improvements with every update, and Intel C++ as a compiler has merged - it still hasn't recovered from its "internal error" on large projects.

Another of our improvements in the compiler in the 1400 build is that it is faster at compiling complex projects.

If it wasn't for this dialogue we probably wouldn't have known about it. More information on the great work you are doing would be appreciated.
 
fxsaber:

On topic. You have to create alternatives to the standard functions, because they sometimes give you the wrong output. Here's an example of SymbolInfoTick alternative

You may call SymbolInfoTick on each event NewTick in the tester and sum up volume-field to know stock turnover. But no, you can not! I have to make much more logical MySymbolInfoDouble.

Welcome to programming, where you are the creator!

We give you the most complete tool, where you can do whatever you want.

 
Renat Fatkhullin:

You can optimise everything around you.

It's an endless process. But 99% of the time it is not economically viable.

We are not talking about optimization here, but about bringing the old function to the new realities. Sure, you could have not written NormalizeDouble at all. And people would have made their own variant. But you created it to save time. It has not been enough now. And it would be good to fix the old bicycle to satisfy the same stock tools.
 
fxsaber:
This is not about optimisation, but about bringing the old function to the new reality. It is clear that you could have not written NormalizeDouble at all. And people would have made their own variant. But you created it to save time. It has not been enough now. And it would be good to fix the old bicycle to satisfy the same stock tools.
Thanks, we'll check it out and see if we can change the library.
 

By the way, not so long ago @iliyas suggested to insert a lot of system functions at compile time as MQL5 source code, so they could take part in inlining and maximum optimization.

I didn't appreciate the idea at first, but now I see that it would be brilliant. The same MSVC does it.

 
Renat Fatkhullin:
Thanks, we'll check and see if we can change the library.

You have misunderstood. Not libraries, but NormalizeDouble. To add an overload.

double NormalizeDouble( double Value, double TickSize );

To normalize prices and lots when TickSize = 25, VolumeStep = 0.5

For example, the normalization would look like this

NormalizeDouble(Price, 0.00001) // Нормализация до пятого знака
NormalizeDouble(Price, 10.0) // Нормализация цены для RTS-9.16
NormalizeDouble(Price, 25.0) // Нормализация цены для MIX-9.16
 
Renat Fatkhullin:

By the way, not so long ago @iliyas suggested to insert a lot of system functions at compile time as MQL5 source codes, so they could participate in inlining and maximize optimization.

I didn't appreciate the idea right away, but now I see that it would be great. The same MSVC does it.

It turns out that #import ex5 is the evil of optimization.

Please pay attention to the preprocessor features

Forum on trading, automated trading systems and strategy testing

How do I go through enumeration sequentially?

Alexey Navoykov, 2016.09.01 23:20

I've already implemented the above method, and it's not so hard to show how to use fixed number of arguments in MQL5, as the number of macros is limited to 8. So I have only 3 values for enum.

As for the theoretical appearance, it's probably faster to create an in-house function for parsing enum. The developers have already promised to create something.


As it turns out, very cunning and user-friendly constructions can be created.

 
fxsaber:

You have misunderstood. Not libraries, but NormalizeDouble. To add an overload.

To normalize prices and lots when TickSize = 25, VolumeStep = 0.5

For example, the normalisation would look like this

You can't overload in this way. Same function signatures.

But the idea is clear - the function of normalization taking into account tick granulation.

 
Renat Fatkhullin:

You cannot overload in this way. Same function signatures.

There doesn't seem to be a problem there. In one variation, the second parameter is int (was), in the other it is double (will appear).

But the idea is clear - the function of normalization taking into account the tick granulation.

Exactly!
 

fxsaber

There is an error in your code