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
The length is never unknown and this topic is just resulting from a bad design.
What do you mean "length of enum"?
Maybe carrot is not a fruit... i still don't understand what Xiangdong Guo means by 'length of enum'
The number of letters from each options string name?
How many options possible?
The numerical value of the option?
Not only bad design but also not very clear about what he means.
The number of values, so 5 in your example of fruits.
I agree it's static it can not be variable so will always be a known fixed value to start with.
However if Xiangdong Guo is testing indicators that he did not design or write himself, and wants to know or detect input parameters automatically...
Not sure how knowing the number of available options could help, perhaps he wants to cross test all available options and is simply looking for the number of tests to run?
i would scan for the assumed options to resolve these values once you try to convert out of the borders of the available options it will generate cannot convert enum error since it does not exist.
MT4/MT5 use C++/C# function to retrieve item from enum. But MetaQuotes doesn't port those functions to MQL4/MQL5. Hum...hum...
MT4/MT5 use C++/C# function to retrieve item from enum. But MetaQuotes doesn't port those functions to MQL4/MQL5. Hum...hum...
Which function ? What is the problem ? Why do you want to loop through enum's items ?
If someone wants/need to do something what is not possible with MQL it does not necessarily mean "bad design".
To topic starter: it is not possible to do what you want in current version of MQL.
The only way is to copy all items into an array and make your loop using that array. But it is only doable when/if you can modify the code.
If someone wants/need to do something what is not possible with MQL it does not necessarily mean "bad design".
To topic starter: it is not possible to do what you want in current version of MQL.
The only way is to copy all items into an array and make your loop using that array. But it is only doable when/if you can modify the code.
Using an enum instead of an array is a bad design. Isn't ?
Using an enum instead of an array is a bad design. Isn't ?
No, using an array instead of enum is a bad design.
Example: Imagine you have a string value. And the task is to find out if this string is equal/contains in it one of the enum items names (EnumToString()).
How would you solve this?