
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
So I have a list of ticket numbers, I select their orders by ticket number and I collect their respective magic numbers.
How do I store that information in an array?
How do I build
Array[ticket][magic]?
Array[1100101][2200202]?
I now how to query/select orders and collect their data. I need the syntax for inserting that data into an array.
So I have a list of ticket numbers, I select their orders by ticket number and I collect their respective magic numbers.
How do I store that information in an array?
How do I build
Array[ticket][magic]?
Array[1100101][2200202]?
I've learned that Numbers[0] = 100110010; doesn't work.
What syntax would work?
Please read the following ...
Array[0][0] = 111111;
Array[0][1] = 222222;
So ticket is 111111 and magic is 222222.
Is that right?
So the first [0] is a perpetual multidimensional symbolic buffer that must never be tampered with if we want to work with multidimensional arrays.
Is that correct? Doesn't sound correct at all to me. Doesn't explain how Array[2] could ever be possible.
OK. So,
Array[0][0] = 111111;
Array[0][1] = 222222;
So ticket is 111111 and magic is 222222.
Is that right?
So the first [0] is a perpetual multidimensional symbolic buffer that must never be tampered with if we want to work with multidimensional arrays.
Is that correct? Doesn't sound correct at all to me. Doesn't explain how Array[2] could ever be possible.
Array[0][0] = 111111;
Array[0][1] = 222222;
instead of
Array[0] = 111111;
Array[1] = 222222;
Really? Then why
Array[0][0] = 111111;
Array[0][1] = 222222;
instead of
Array[0] = 111111;
Array[1] = 222222;
An array is of a single type, it does not matter if it's 1D, 2D or 3D—it's ALWAYS a single type.
So if you want to store both "ticket numbers" and "magic numbers" then you can't use simply type arrays. You would need to use an array of a structure (a complex data-type)
Arrays of a structure are still arrays of a single type, but that type is no longer a simple data-type like "int" or "double", but a complex data type that stores multiple pieces of information.
However, such an array of a structure is even more complex. So, until you fully understand how a array of a simple data-type works, you will not be able to understand and implement complex types.
I gave you a link about Multi-dimentional arrays in C. Forget about what you are trying to achieve and first focus on learning about arrays in an "academic" fashion.
Once you full understand how that works, then you can evolve to arrays of structures. Examples of arrays of structures are, the MqlRates array returned by CopyRates, or the MqlTicks array returned by CopyTicks.
An array is of a single type, it does not matter if it's 1D, 2D or 3D—it's ALWAYS a single type.
So if you want to store both "ticket numbers" and "magic numbers" then you can't use simply type arrays. You would need to use an array of a structure (a complex data-type)
Arrays of a structure are still arrays of a single type, but that type is no longer a simple data-type like "int" or "double", but a complex data type that stores multiple pieces of information.
However, such an array of a structure is even more complex. So, until you fully understand how a array of a simple data-type works, you will not be able to understand and implement complex types.
I gave you a link about Multi-dimentional arrays in C. Forget about what you are trying to achieve and first focus on learning about arrays in an "academic" fashion.
Once you full understand how that works, then you can evolve to arrays of structures. Examples of arrays of structures are, the MqlRates array returned by CopyRates, or the MqlTicks array returned by CopyTicks.
Yes, they are the same underlying data-type, but they are not of the same "meaning". They are two different types even if implemented the same way.
I doubt the OP is trying to store "magic numbers" and "ticket numbers" all in the same bag without being able to differentiated between the two types.
The OP is most probably trying to classify the orders by their magic number, and identifying them by their ticket number. That requires either separate arrays, or an array of a structure.
Since the OP has not explained their intent, this may even turn out to be an X/Y problem, and the ideal solution may not even need 2D or 3D arrays.
In the end it may just need a 1D array of a structure. However, it will be good for the OP to first learn how arrays work.