Hi all, is there the possibility to shift a portion of code in an .mqh file, in order to obtain a smaller .mq4 file?
I'd like to shift in a .mqh file the part code in which I create the Global Variables, but I don't want to create a single .mqh file for every Global Variable (using the return function).
Thank you!
Sure.
Just include the mqh-file in your mq4.
That's it
Hi all, is there the possibility to shift a portion of code in an .mqh file, in order to obtain a smaller .mq4 file?
I'd like to shift in a .mqh file the part code in which I create the Global Variables, but I don't want to create a single .mqh file for every Global Variable (using the return function).
Thank you!
Typically you want to put declarations in the header files and code in the implementation files.
Consider (for C++)
https://stackoverflow.com/questions/583255/c-code-in-header-files
Typically you want to put declarations in the header files and code in the implementation files.
Consider (for C++)
https://stackoverflow.com/questions/583255/c-code-in-header-files
Except with MQL:
something_h.mqh
class Something : public CObject { public: void PublicMethod(); }; #include "../src/something_src.mqh" //don't have to do this with C++
something_src.mqh
//Something src #include "../include/something_h.mqh" void Something::PublicMethod() { Print("Hello world!"); }
program.mq4
#include "include/something_h.mqh" Something *something = new Something;
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all, is there the possibility to shift a portion of code in an .mqh file, in order to obtain a smaller .mq4 file?
I'd like to shift in a .mqh file the part code in which I create the Global Variables, but I don't want to create a single .mqh file for every Global Variable (using the return function).
Thank you!