OOP, templates and macros in mql5, subtleties and uses - page 18

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
it works!
Thank you!
Help me solve this problem. There is a macro and I want to add code inside it to return the result.
Is it possible to add code in the given place so that I could return the result from the macro? You can add the code; I tried it but if you write return, the effect is not expected. I saw this example
here in the thread where return works.
Help me solve this problem. There is a macro and I want to add code inside it to return the result.
Is it possible to add code in the given place so that I could return the result from the macro? You can add the code; I tried it but if you write return, the effect is not expected. I saw this example
here in the topic where return works.
Call a function in which you pass a pointer to another function (loop body, for example)
Call a function in which you pass a pointer to another function (the body of a loop, for example)
I didn't know it was possible to do this, but my goal is to write a complex multi-line macro that will execute many commands, probably a macro can't execute many commands and making it a function is not possible? Sometimes there is a need to extract for example a loop from a function, I was wondering if it's possible, maybe I'm writing nonsense.
I didn't know it was possible to do such a thing, but my task is to write a complex multi-line macro, which will execute many commands, probably a macro can't execute many commands and making a function out of it is impossible? Sometimes there is a need to make a loop out of a function, I wonder if it's possible, maybe I'm writing nonsense.
I don't know what the task is and whether you are digging there, but at a glance - another approach:
This way you can replace any piece of function (not necessarily array filling as it is in my case) and instantiate it as needed.
I didn't know it was possible to do such a thing, but my task is to write a complex multi-line macro, which will execute many commands, probably a macro can't execute many commands and making a function out of it is impossible? Sometimes I may need to make a loop out of a function, I wonder if it is possible, maybe I am writing nonsense.
It is possible, but not like this.
You can, but not like this.
This macro will be void, in order to return a result from it you need an expression to be calculated, in other words you need to call a function inside it, I've come to this conclusion.
Call a function in which you pass a pointer to another function (loop body, for example)
I studied a function pointer, to be honest I never understood what it's for, in fact you can call a function instead of a variable may come to me tightly, a function pointer resembles an overload or polymorphism.
I've been studying the function pointer, to be honest I haven't understood what it's for, basically you can call a function instead of a variable maybe I'm getting a hard time, the function pointer is like an overload or polymorphism.
You have some algorithm inside which you can put a sub-algorithm, so to speak, to "tweak" it to solve a particular problem. In essence, it's an analogue of virtual functions. The main thing is you asked for it yourself, and now you don't know why)), you had a framework, inside which you put a loop.