ENUM char -
"-" minus is reserved for subtractions, you can't use it in a variable or enum name.
You can use underscore "_" - it's close enough.
"-" minus is reserved for subtractions, you can't use it in a variable or enum name.
You can use underscore "_" - it's close enough.
It"s not good message for me :( My broker use "-" in symbol names :-/
Use the "-" sign in the ENUM can not. Why is this design? What do you like to do?
.. Other code ...
enum ENUM_SYMBOL_LIST // List of symbols { EURUSD, AUDCAD, GOLD, CORN-JUL15, GSOIL-JUN15 }; input ENUM_SYMBOL_LIST InpSymbol=EURUSD; // User selecting symbol name
MqlTradeRequest request = {0}; request.action = TRADE_ACTION_DEAL; request.magic = 777; request.symbol = EnumToString(InpSymbol); // Used user selected symbol name from listbox request.volume = 0.01; request.sl = 0; request.tp = 0; request.type = 1; MqlTradeResult result={0}; OrderSend(request,result);
... Other code ...
.. Other code ...
... Other code ...
enum ENUM_SYMBOL_LIST // List of symbols { EURUSD, // EURUSD AUDCAD, // AUDCAD GOLD, // GOLD CORN_JUL15, // CORN-JUL15 GSOIL_JUN15 // GSOIL-JUN15 }; input ENUM_SYMBOL_LIST InpSymbol=EURUSD; // User selecting symbol name
Thank you very much, I will use enum with "_" and in traderequest a will use before EnumToString() to new string variable .. and after I will use StringReplace() for change from "_ " to "-".
Thanks everybody :-)
P.S.:Perhaps it is a pity that does not MQL5 enum containing the names of symbols from trade, this would facilitate the work :-)
Please,
do you know how can I add to the ENUM list values string with - char ?
I want this code:
enum ENUM_SYMBOL_LIST // List of symbols
{
EURUSD, // This is OK value
AUDCAD, // This is OK value
GOLD, // This is OK value
CORN-JUL15, // This is ERROR value '-' - comma expected
GSOIL-JUN15 // This is ERROR value '-' - comma expected
};
Thank you very much