Features of the mql5 language, subtleties and tricks - page 138
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
// Некоторые возможности структур, которых нет у классов.
hm, interesting, really liked the idea with const fields, const will only be initialised once
hm, interesting, I like the idea with const fields, const will be initialized only once
you can now do lot normalization in this way:
You can declare constant members in classes too.
You can also declare constant members in classes.
Well, yes, I don't use all modifiers properly here, that's why it caused my admiration, I checked it, now I obfuscated the code, though I wanted just to write it compactly ))))
ZS: the folding in ME is really lacking! - it's tiring to roll the mouse wheel here and there (((My implementation of construct for each by MQL.
So far, it only works for arrays: 1) regular mql-arrays; 2) custom array classes, which should have [](int) operator defined and globalArraySize function overloaded.
Syntax:
An array can be defined as either a variable or an expression - that's why we had to build the garden.) The expression is executed once, storing a pointer to the array, and then accessing the pointer.
Usage examples:
Examples of use:
A little rewritten
My implementation of construct for each by MQL.
So far, it works only for arrays: 1) regular mql-arrays; 2) custom array classes, which should have [](int) operator defined and global ArraySize function overloaded.
That's cool! Is it possible to make such a variant?
That's cool! Is it possible to do a version of this?
foreach(Ticks[0], Ticks) ArrayPrint(Ticks[0].bid);
Well, initializing an array with variables is not supported in MQL. You can do an assignment to an array element:
I haven't figured out the implementation, but I don't see the point in doing it that way.
This does not work
This variant doesn't work
At first I thought it was a feature of MQL, but it's the same in C++.
At first I thought it was a feature of MQL, but it's the same in C++ too.
because the type is const int. it is just that in the template you can still attach const to the front without any problems
but if in c++ you can remove const from a type by some simple manipulations, you can't do it in mql.