How to get length of enum and item in MQL4/MQL5 ?
I've searched forum and code base, but didn't get answer.
:-(
What do you mean with "length of enum"?
Can you provide an example of usage to understand you question - probably enum is not what you are looking for?
What do you mean with "length of enum"?
Can you provide an example of usage to understand you question - probably enum is not what you are looking for?
Print("Current bar ",TimeToStr(array1[0][0]),"Open", array1[0][1]);
From MQL4 ,might be useful
Print("Current bar ",TimeToStr(array1[0][0]),"Open", array1[0][1]);
From MQL4 ,might be useful
Thanks, Maryann.
But it can't solve my question.
Thanks, Maryann.
But it can't solve my question.
How to get length of enum and item in MQL4/MQL5 ?
How to get length of enum and item in MQL4/MQL5 ?
For example, there has an enum definition:
Next, I want to use it in loop:
How to implement this requirement?
I've searched forum and code base, but didn't get answer.
:-(
If you want to loop through a list use an array!
An enum is a kind of a variation of #define:
#define APPLE 0 #define BANANA 1 #define GRAPE 2 ....
Enum is very useful e.g. for input variables!
enum Fruit {Apple,Banana,Heineken}; int err=0; int scan=0; string item_name; while(err==0) { item_name=EnumToString(Fruit(scan)); err=GetLastError(); if(err==0) Alert(item_name); scan++; }thats the closest i got if the length is unknown
thats the closest i got if the length is unknown
The length is never unknown and this topic is just resulting from a bad design.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
How to get length of enum and item in MQL4/MQL5 ?
For example, there has an enum definition:
enum ENUM_FRUIT {APPLE, BANANA, GRAPE};
Next, I want to use it in loop:
How to implement this requirement?
I've searched forum and code base, but didn't get answer.
:-(