Features of the mql5 language, subtleties and tricks - page 297

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
There are appropriate inputs there.
INC_SORT_BY(array,field) - sort the array of structures by the specified field;
It is hardly possible to make it shorter :-)
On the topic of performance.
Forum on trading, automated trading systems and testing trading strategies.
Peculiarities of mql5 language, subtleties and techniques of work
fxsaber, 2022.06.19 16:17
I would conversely drop the semicolon at the end of the macro call to emphasise that it's not a function.
Then the code becomes less readable. Its perception is disturbed. Also, when using a loop, you may use break in a macro.
I wonder if the final compiler code with/without do-while is different if break is not used.
user-user:
INC_SORT_BY(array,field) - sort an array of structures by a given field;
Shorter is hardly possible anymore :-)
user-user:
INC_SORT_BY(array,field) - sort an array of structures by a given field;
Shorter is hardly possible anymore :-)
I would modify your macros like to this better implementation:
I used a simple "insertion sort" function for its small code size although it is not the fastest sort.
For more speed, you should replace it with QuickSort or a hybrid sort function.
Edit:
you can also use my introsort library for max. performance https://www.mql5.com/en/code/57233
Is it possible to define text without quotes and use it as a string? There is an error without inverted commas.
Is it possible to define text without quotes and use it as a string? There is an error without inverted commas.
This can be done using a stringify operator # inside macro:
In your example you should use indirection (2nd level macro) to expand 'str" macro to aaa before using # operator:
This can be done by using the stringify # operator inside the macro....
Thank you.