Features of the mql5 language, subtleties and tricks - page 290
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
Such a loop will loop through all charts, including even nested OBJ_CHART variants (for which OBJPROP_CHART_ID was called)
Example.
Result.
I use such a universal construction of setting on/off Common-folder via file name.
If the file name contains an asterisk, it will open in the Common folder, otherwise - as specified.
Who knows how to make this work ?
to get a Sort template ( array_pointers, compare_function )
Who knows how to make something like this work ?
to get a Sort template ( array_pointers, compare_function )
Template pointers to functions do not work in MQL5.
Template pointers to functions do not work in MQL5.
sadly... :-(
so until there is a pointer to a member-function (what a word that is), it is premature to talk about human OO in MQL.
It is premature to talk about human OO in MQL
Forum on trading, automated trading systems and testing trading strategies
Do I need multiple inheritance of interfaces in MQL?
Koldun Zloy, 2025.01.23 14:29
It is a feature that can easily be done without.
It will not untie anyone's hands.
It has nothing to do with development.
Is there a modern language where you can't make a template Sort() ?
PS/ unlike multiple inheritance it can be done ugly through #define SORT(arr,func). But that's cheesy from the 80's. Why it's not in templates is a mystery to meTemplate pointers to functions do not work in MQL5.
There is a nice solution to overcome that limitation of MQL. The trick is to pass the templated CompareFunc to the generic sort function both as a function pointer + a type parameter T .
This trick helps the compiler to resolve the typename parameters..
GenericSortTemplated.mq5
The sort function is templated. The compare function is also templated. The highlight colors indicate how the typename parameters are specialized and resolved.
output:
While I was conducting some tests I tried to build my application as .exe instead of .dll and imported it into my mql5 EA and saw that the compiler doesn't give me any errors and also I can use static functions inside the program.
Since I couldn't find anything about importing .exe programs in the documentation I was wondering if that implies something I am now aware of. Does it impact the lifecycle of the EA? Does the terminal manage .exe imports differently from .dlls in any way?
Thanks for your time.