Consider incorporating the data into the compile cycle. Generate an include file of all that data in that file, in what ever structures it needs as global variables, and include it in the compilation for your testing,
Then remove it for the final executable that will work with an actual file.
Consider incorporating the data into the compile cycle. Generate an include file of all that data in that file, in what ever structures it needs as global variables, and include it in the compilation for your testing,
Then remove it for the final executable that will work with an actual file.
Won't it need "static generation" in that include file ? otherwise i'll be loading again , not from the drive but still .
Globally scoped variables that are initialised during the declaration are equivalent to static variables and are "baked"/"hard-coded" into the executable file.
Just don't change their content at runtime, as sometimes during odd circumstances the Strategy Tester carries those changes over to the next pass. Consider them as constant data.
EDIT: I think you can even declare them as "const" global variables so as not to allow changes but I've never tested that in MQL.
EDIT2: Yes, "const" works correctly and prevents changes to the global variables.
const double dbTest = 1.34; void OnStart() { dbTest = 2.34; };
Maybe I misunderstood your question. Yes, you have to declare global variables of the structures and initialise their data with literal constants of the data.
struct SData { string sName; double dbValue; }; const SData g_oData[] = { { "EUR", 1.12 }, { "USD", 1.0 } };
Yes, that is what I am talking about. Is there a problem with using globally scoped variables?
i must put structures into these : ?
- www.mql5.com
Don't use Global Terminal Variables during testing. Besides being slow and file based, they are shared amongst everything—live running EAs, EAs being tested, multiple passes in optimisations, etc.
Instead, use globally scoped variables as I have described, in your code at compile time.
Don't use Global Terminal Variables during testing. Besides being slow and file based, they are shared amongst everything—live running EAs, EAs being tested, multiple passes in optimisations, etc.
Instead, use globally scoped variables as I have described, in your code at compile time.
I'll need to iterate through the members of structures , i'll go ahead and assume the only way is custom arrays with members , or , dedicated function to export code .
Thanks
Terminal variables are for interprocess communications (e.g. EA to EA) and persistent storage (recovery). Your use is neither.
Thanks
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
subsequent pass not having to load the file again ?
(load a constant structure once from a file and work on that , sort of)
tx