
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
Change the variable type in one place and the compiler will show errors in the other three - change the field name. You would think there are dozens of structures that need to be sorted. Yes, one structure most likely requires sorting.
No, do not set the task this way
set the following task: use your example to sort through the structure that has dozens of fields by each field
let it be a structure that contains all the properties of the order "four" (OrderStoploss(), OrderTakeProfit(), OrderOpenTime()....) - there are a dozen of them
And reproduce the sorting of an array of such structures by each field with your examples? - imho, your code will weigh quite a bit, and I wrote above that it won't be possible to reuse this code
No, that's not how you should set the task.
set the following task: using your example, sort the structure that has dozens of fields by each field
let it be a structure containing all the properties of the order "four" (OrderStoploss(), OrderTakeProfit(), OrderOpenTime()....) - there are a dozen of them
And reproduce the sorting of an array of such structures by each field with your examples? - imho, your code will weigh quite a bit. I wrote above that it won't be possible to use this code repeatedly.
A problem from the realm of science fiction, never encountered in practice.
You can make a separate field to sort by and before sorting, copy into it from the field you want to sort by.
In MT 5 it works without problems in MT 4 it blamesArraySwap because Mql 4 does not support it...
A challenge from the realm of fiction.
No, it is possible to use MQL, just as you suggested using SB
But the problem will be that this code will be written for a certain task
If we give an example - the terminal panel with orders has been reproduced as a window in MQL, the sorting has been done, everything spins, everything works
And if you want to use a part of the code to display the "optimization" panel of the tester, you will get a carload of changes. It's easier to write the code from scratch, including sorts, and you will want to have human readable field names? - otherwise you need to be the author of a well-known "kernel" to keep in mind all the names of identifiers in the form of Abyrwalg (A Dog's Heart)
)))
No, it is possible to use MQL, just as you suggested using SB
but the problem will be that this code will be written for a specific task
If we give an example, the terminal panel with orders has been reproduced as a window in MQL, the sorting has been done, everything spins, everything works
And if you want to use a part of the code to display the "optimization" panel of the tester, you will get a carload of changes. It's easier to write the code from scratch, including sorts, and you will want to have human readable field names? - otherwise you need to be the author of a well-known "kernel" to keep in mind all the names of identifiers in the form of Abyrwalgh (A Dog's Heart)
)))
Anything that can be misunderstood will be misunderstood. I meant not the possibility/impossibility, but the practical need for it, i.e. the occurrence of this task.
It's not my idea that for each structure you must write your own Compare().
Why sort the array/vector of thick structures into different fields ?
let it lie as it is, it has the right to be even const :-) and for different purposes you can build indexes
It's not my idea to write a different Compare() for each structure.
That's exactly how it is, or rather I don't know any other way, and this method will be tied to a specific task
and the author wants a universal solution for 10 quid, well, let's wait and see if something clears up
Why sort the array/vector of thick structures into different fields ?
Let it lie as it is, it has the right to be even const :-) and for different purposes you can build indexes
Someone will write now ... that it's so inconvenient for me ... that we are not housewives, but superdevelopers, and we must use all possibilities of modern programming technologies, while an additional array is something like the Middle Ages ...
Although, personally, I like this option better.
No way:
1) It's enough to insert ArrayCopy into conditional compilation, not ArraySwap.
2) ArrayCopy needs to be written in custom one, as standard one doesn't support NonPod structures.
3) We need one more conditional compilation for ArrayResize multi-domain array (function gives different results for different MT versions)
It won't:
The answer was not for all occasions. Most people close.