struct Struct_Example { int ID; double Value; string Label; };
And I declare a two-dimensional array of this structure in a class:
What you’re seeing is not really a bug in the compiler, but more of a limitation in how MetaEditor’s auto-complete works.
When you work through a pointer to a class, the editor will still show private members in the suggestion list, even though you cannot actually call them. The compiler will reject the code if you try, so it’s only an IntelliSense quirk. The only way around it is to hide the pointer behind an interface or a wrapper that only exposes the methods you actually need. That way the editor only proposes the public surface and the suggestions look cleaner.
With the structure array problem it’s the same story. If you declare a two-dimensional array of a struct and try to access an element with Matrix[i][j]. , the editor won’t suggest any members. The code is valid and compiles fine, you can type ID or Value manually and it will work, but completion just doesn’t kick in. If you first assign the element to a reference or pointer, completion suddenly works again. For example:
Struct_Example &cell = Matrix[i][j]; cell.ID = 123; // members are now suggested
You can also wrap the access in a helper function that returns the element by reference, and again you’ll get normal completion when using it.
So both issues come down to the same thing: MetaEditor’s introspection is a bit limited. The code itself is fine, it runs and compiles correctly, but the editor doesn’t always know how to display the members. If it bothers you a lot, the best thing you can do is send feedback to MetaQuotes. Until then, small workarounds like using references or interfaces are usually enough to make coding less painful.
Personally I don’t overuse references in MQL. I bring them in when it makes sense, for example to avoid copying a bigger struct, or when I want clean access like
auto &cell = Matrix[i][j];
. In that case it also has the side effect of fixing the completion issue.
For simple types I just use plain values, and if I need something that can be reassigned or nullable then I’ll go with a pointer. So references are part of the toolkit, but only where they add value.
Personally I don’t overuse references in MQL. I bring them in when it makes sense, for example to avoid copying a bigger struct, or when I want clean access like
auto &cell = Matrix[i][j];
. In that case it also has the side effect of fixing the completion issue.
For simple types I just use plain values, and if I need something that can be reassigned or nullable then I’ll go with a pointer. So references are part of the toolkit, but only where they add value.
MQL does not support references. Code like your examples cannot be compiled. Your posts are AI generated and you yourself do not understand what you are posting. You are misleading users who don't know you are posting bullshit.
I'm asking you if I'm a liar?
You probably didn't notice that my first 2 posts in this thread weren't addressed to you.
[edit]
Since MQL doesn't support references.
You cannot declare reference as shown below and such code cannot be compiled:
Forum on trading, automated trading systems and testing trading strategies
MetaEditor: autocompletion displays
Matei-Alexandru Mihai, 2025.09.06 12:32
For example:
Struct_Example &cell = Matrix[i][j]; cell.ID = 123; // members are now suggested
Forum on trading, automated trading systems and testing trading strategies
MetaEditor: autocompletion displays
Matei-Alexandru Mihai, 2025.09.06 16:45
auto &cell = Matrix[i][j];

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Good morning,
I'm encountering an annoying limitation in MetaEditor.
In one class, I declare a pointer to another class:
When I write this.Pointer_Check_Data. in the editor, auto-completion offers me the private members and methods of Check_Historical_Data , which it shouldn't.
This behavior is confusing because it blurs the distinction between public interface and encapsulation. Would it be possible to improve MetaEditor's introspection so that it respects member visibility when accessing via pointer?
Thanks in advance.