I actually avoid coming here, but I've spent 90 minutes trying to solve this big mystery with no success because the documentation absolutely does not help and all examples I find are very complex, seemingly going out of their way to avoid the simple.
The first variable assignment line causes an error. I can't understand why.
The second variable assignment line is correct. But that will assign "200220020" to [0][1]. And what is [0]? How do I assign just [0]?
I also need to iterate over the 0th dimension so I need to get [0] alone.
Whenever I try accessing the 0th dimension alone, I get errors. MQL4 wants both indexes. But I just want to check the 0th dimension. It seems the 0th dimension is completely out of my reach. I can only set and access the 1st dimension. That amounts to a one-dimension array.
What I really want is an Array Search mechanism.
I made it because MQL4 doesn't have it. ArrayBsearch "returns index of a found element. If the wanted value isn't found, the function returns the index of an element nearest in value." The "element nearest in value" doesn't really do what I need. I need either an absolutely accurate index or -1 or something that tells me the array element doesn't exist. I won't even try to understand why someone thought that returning an incorrect value just because it is "nearest in value" was a good idea.
So how do I set and access the 0th dimension?
Note: structs won't do. I need something I can search. i.e. I need to be able to iterate over it.
Thank you for any attention.
But I still have no idea of how to work with the 0th dimension.
How do I set or access Numbers[0]?
I can imagine someone searching for that information just like I did today and not finding a simple, straightforward, practical example just like I didn't today.
So are you telling me the 0th dimension is completely useless and I have to do this?
int Numbers [][20][1]; Numbers[0][0] = 100110010; Numbers[0][0][1] = 200220020;
Thank you for your reply.
But I still have no idea of how to work with the 0th dimension.
How do I set or access Numbers[0]?
I can imagine someone searching for that information just like I did today and not finding a simple, straightforward, practical example just like I didn't today.
So are you telling me the 0th dimension is completely useless and I have to do this?
Paul Anscombe #:
You should google multi dimensional arrays and learn the basics
Well,
I've spent 90 minutes trying to solve this big mystery with no success because the documentation absolutely does not help and all examples I find are very complex, seemingly going out of their way to avoid the simple.
An array of [10][10]. Is 100 elements their is no first element without the second part only 10 rows of 10 elements
And how was the first [10] in [10][10] created?
How is that created or accessed?
See how adamantly mysteriously mysterious this thing is?
No wonder there are no practical examples to be found. It's like some sort of taboo.
[10][10} means 10 x 10 = 100, addressed in the following way
[0}[0], [0}[1], [0][2] ... [0][8], [0][9], [1][0], [1][1], [1][2] ... [1][8], [1][9], [2][0], [2][1], [2][2], ... ... [8][8], [8][9], [9][0], [9][1], [9][2] ... [9][8], [9][9]
// Simple example (uncompiled, untested, simply typed out) int naSquare[10][10]; for( int i = 0; i < 10; i++ ) for( int j = 0; j < 10; j++ ) naSquare[i][j] = i * 10 + j;
Well,
And how was the first [10] in [10][10] created?
How is that created or accessed?
See how adamantly mysteriously mysterious this thing is?
No wonder there are no practical examples to be found. It's like some sort of taboo.
How do I store that information in an array?
How do I build
Array[ticket][magic]?
Array[1100101][2200202]?
I lnow how to query/select orders and collect their data. I need the syntax for inserting that data into an array.
Well,
And how was the first [10] in [10][10] created?
How is that created or accessed?
See how adamantly mysteriously mysterious this thing is?
No wonder there are no practical examples to be found. It's like some sort of taboo.
There is no taboo. There is no mystery. This is simple maths. A 2D array is a simple table (spreadsheet, chess board, soduko square, etc.)
1D array is a vector, a 2D array is a matrix, ... can be extended to more dimensions ... 3D, 4D , etc.
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?
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I actually avoid coming here, but I've spent 90 minutes trying to solve this big mystery with no success because the documentation absolutely does not help and all examples I find are very complex, seemingly going out of their way to avoid the simple.
The first variable assignment line causes an error. I can't understand why.
The second variable assignment line is correct. But that will assign "200220020" to [0][1]. And what is [0]? How do I assign just [0]?
I also need to iterate over the 0th dimension so I need to get [0] alone.
What_I_Want = Numbers[0]; if (What_I_Want == What_I_Really_Want) {OK_Lets_Proceed();}
Whenever I try accessing the 0th dimension alone, I get errors. MQL4 wants both indexes. But I just want to check the 0th dimension. It seems the 0th dimension is completely out of my reach. I can only set and access the 1st dimension. That amounts to a one-dimension array.
What I really want is an Array Search mechanism.
I made it because MQL4 doesn't have it. ArrayBsearch "returns index of a found element. If the wanted value isn't found, the function returns the index of an element nearest in value." The "element nearest in value" doesn't really do what I need. I need either an absolutely accurate index or -1 or something that tells me the array element doesn't exist. I won't even try to understand why someone thought that returning an incorrect value just because it is "nearest in value" was a good idea.
So how do I set and access the 0th dimension?
Note: structs won't do. I need something I can search. i.e. I need to be able to iterate over it.
Thank you for any attention.