
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
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.
That is much too complex for the OP at this stage. 😅
That is much to complex for the OP at this stage. 😅
People have really put in some energy to help you, I would say it is now up to you to understand what was given to you.
I agree with that statement and I appreciate it. Thank you all.
I think I understand it now. I even have written code that will compile without errors and it also seems to work.
I find MQL4 very frustrating. In my own world, I would do:
Or something like that.
The lack of foreach and simple lists in MQL4 forces me to build some hideous Rube Goldberg machines.
Thank you.
I agree with that statement and I appreciate it. Thank you all.
I think I understand it now. I even have written code that will compile without errors and it also seems to work.
I find MQL4 very frustrating. In my own world, I would do:
Or something like that.
The lack of foreach and simple lists in MQL4 forces me to build some hideous Rube Goldberg machines.
Thank you.
Fernando Carreiro #:
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.
I exposed part of my intent. Let me put it another way:
Groups of orders share the same magic number.
I need to identify all of these groups.
I need to iterate over all orders and collect all their magic numbers.
Since those are groups, all magic numbers will be found more than once. I need to weed out those repetitions.
Once I have a clean list of all unique magic numbers, I want to iterate over all the orders that carry each magic number. i.e. iterate over each group.
I intend to apply multiple actions on each group. Which order is newest, which is oldest, which is profiting, which is losing, which is the most profitable etc.
For that I need a list. A list of lists actually.
MQL4 doesn't have lists, only arrays. And they are not very friendly.
Rube Goldberg machine ensues.
I exposed part of my intent. Let me put it another way:
Groups of orders share the same magic number.
I need to identify all of these groups.
I need to iterate over all orders and collect all their magic numbers.
Since those are groups, all magic numbers will be found more than once. I need to weed out those repetitions.
Once I have a clean list of all unique magic numbers, I want to iterate over all the orders that carry each magic number. i.e. iterate over each group.
I intend to apply multiple actions on each group. Which order is newest, which is oldest, which is profiting, which is losing, which is the most profitable etc.
For that I need a list. A list of lists actually.
MQL4 doesn't have lists, only arrays. And they are not very friendly.
Rube Goldberg machine ensues.
I ported some of my EAs to it and I never hated anything more in my whole life. Absolutely insane.
I will not migrate and neither will a very large number of people.
But thank you for the attention.
You are on the wrong track. Sooner or later you WILL need to migrate to MQL5. It is not a question of "if" but "when" (and it may be sooner than you think)
If you keep denying it, when the day comes, then you will have to rush to be able to switch over. If you do it NOW, you will still be able to take slowly.
When I did it, I also thought the MT5 trade system was a nightmare, but once I accepted that I needed to learn it, I slowly began to understand it and conquer it.
Now, I love it and consider MT4/MQL4 a pain and a drag, not to mention all the other advantages and opportunities that MT5/MQL5 offers.
I've stopped writing MQL4 EAs completely and I see no reason at all to go back. I don't regret taking the plunge, not one bit.
You are on the wrong track. Sooner or later you WILL need to migrate to MQL5. It is not a question of "if" but "when" (and it may be sooner than you think)
If you keep denying it, when the day comes, then you will have to rush to be able to switch over. If you do it NOW, you will still be able to take slowly.
When I did it, I also thought the MT5 trade system was a nightmare, but once I accepted that I needed to learn it, I slowly began to understand it and conquer it.
Now, I love it and consider MT4/MQL4 a pain and a drag, not to mention all the other advantages and opportunities that MT5/MQL5 offers.
I've stopped writing MQL4 EAs completely and I see no reason at all to go back. I don't regret taking the plunge, not one bit.
That's 6 times as many advantages and opportunities.
How can anyone not love such an overflow of joy.