Using MetaEditor version 5.00 build 5430, Nov 14, 2025
I've read the docs on vectors, and trying a toy example, which compiles with the errors:
Here's the toy code:
According to the docs, `vector` is its own type, and the way it's used here is as type double.
On line 32, I can type `vector_a`, followed by a period('.'), hit the Tab key and get the code hint that includes all the applicable methods for matrices and vectors.
If I remove `.Percentile(25) from line 32, leaving just `vector_a;` and compile, I get:
which says `vector_a` is defined.
How do I correctly define and use vectors?
Thanks in advance for the help.
Please, post the complete code.
File is attached. Like I mentioned, it's just a toy example. Most of it is comments.
Well, the initialization of the vector compiles normally.
The error comes from the next line:
vector_a;
which is incorrect, because it's incomplete global expression - you should use the variable somehow (for example in assigment/further initialization/calculation/as a parameter for a function call/etc):
vector vector_b = vector_a; You can't write a standalone variable name in the global scope, but you can do it in a function:
void xyz() { vector_a; // WARNING: expression has no effect }
Yet, you'll see the warning, because the code makes no sense.
Well, the initialization of the vector compiles normally.
The error comes from the next line:
which is incorrect, because it's incomplete global expression - you should use the variable somehow (for example in assigment/further initialization/calculation/as a parameter for a function call/etc):
You can't write a standalone variable name in the global scope, but you can do it in a function:
Yet, you'll see the warning, because the code makes no sense.
I understand what you are referring to. As I tried to point out, I tried to use the Percentile() method on vector_a, which also didn't work. Example:
It seems, you should learn coding a bit, because your question/error is simple and already answered above (write instructions in a function, not in the global scope, until you know how to use the global scope). There are a number of books on MQL programming, explaining the basics needed to eliminate such errors.
It seems, you should learn coding a bit, because your question/error is simple and already answered above (write instructions in a function, not in the global scope, until you know how to use the global scope). There are a number of books on MQL programming, explaining the basics needed to eliminate such errors.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Using MetaEditor version 5.00 build 5430, Nov 14, 2025
I've read the docs on vectors, and trying a toy example, which compiles with the errors:
Here's the toy code:
// everything above here is boilerplate comments .. 31 vector vector_a = {50228.0,50268.0,50143.0 }; 32 vector_a.Percentile(25);According to the docs, `vector` is its own type, and the way it's used here is as type double.
On line 32, I can type `vector_a`, followed by a period('.'), hit the Tab key and get the code hint that includes all the applicable methods for matrices and vectors.
If I remove `.Percentile(25) from line 32, leaving just `vector_a;` and compile, I get:
which says `vector_a` is defined.
How do I correctly define and use vectors?
Thanks in advance for the help.