Simple - you need to rename your enum values with something else.
& is reserved, so you can't use it.
satrap: it seems we can't use "&" and "-" characters in enumeration. | Identifiers - MQL4 Documentation states: Characters allowed to be written
in an identifier: figures 0-9, the Latin uppercase and lowercase letters
a-z and A-Z, recognized as different characters, the underscore
character (_).The first character can not be a digit. The identifier must not coincide with reserved word. |
not all of the symbol name are used allowed words.
does it make sense to rename symbol name and restore back when using (S&P500, and etc.)?
i remember in C language can use double words to print reserved character sets.
not all of the symbol name are used allowed words.
does it make sense to rename symbol name and restore back when using (S&P500, and etc.)?
i remember in C language can use double words to print reserved character sets.
You wouldn't be able to use any of the symbol enums directly in your code because they will be integers and any code using symbols would require a string.
You could use a switch block to assign string values to a variable in init
You could use a switch block to assign string values to a variable in init
in addition to GumRai's solution
you can work out to get the symbols name using SymbollName
You wouldn't be able to use any of the symbol enums directly in your code because they will be integers and any code using symbols would require a string.
You could use a switch block to assign string values to a variable in init
Sorry, I don't get your point. Could you explain more detail?
My current design:
all symbols defined in enum selected by user
Use "EnumToString" to get the string of symbol name defined in enum.
My point of view is user doesn't need to open any charts evein in MarketWatch to run my EA.
My point of view is user doesn't need to open any charts evein in MarketWatch to run my EA.
there is no such thing
without attaching the EA, indicator or script to a chart it can't work
Sorry, I don't get your point. Could you explain more detail?
My current design:
all symbols defined in enum selected by user
Use "EnumToString" to get the string of symbol name defined in enum.
My point of view is user doesn't need to open any charts evein in MarketWatch to run my EA.
You've already discovered that you cannot use S&P500
Therefore you cannot simply use EnumToString as you will have to use something like SP500 as the Enumeration.
"SP500"will not be recognised as a valid symbol
So use a switch block to assign a value to a string variable depending on the Enum selected.
GumRai: So use a switch block to assign a value to a string variable depending on the Enum selected.
| As instring EnumToSymbol(ENUM_ORDER_SYMBOL e){ switch(e){ case SP500: return("S&P500"); case OILUS: ... default: return(EnumToString(e)); // EURUSD } }Of course that won't work with brokers using adorned symbols // Broker's use a variety of nameing patterns: EURUSD, EURUSDm, EURUSDi // "EURUSD.", "EURUSD..", "EUR.USD", "EUR/USD", "EURUSD.stp", EURUSDct, // "EURUSD.G", "EURUSD+", EURUSDpro at least. |

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
When I compiler following code
---------- code begin ------------
enum ENUM_ORDER_SYMBOL{
EURUSD, S&P500, OILUS
};
---------- code end ------------
there're "comma expected" error #155
it seems we can't use "&" and "-" characters in enumeration.
how to solve this issue?