string sym = EnumToString (METAL,AUD,EUR,GBP,USD);
- Of course not. EnumToString takes a single variable (of an enumeration type.)
Curr = sym; CurrBid = MarketInfo(Curr, MODE_BID);
This makes no sense. If sym is a list, you can't pass it to MarketInfo. Just pass each symbol.enum metal{GOLD,SILVER}; input metal METAL; enum aud{AUDCAD,AUDCHF,AUDJPY,AUDNZD,AUDUSD}; input aud AUD; : do_sym(EnumToString(METAL) ); do_sym(EnumToString(AUD) ); :
- I recommendDo not trade multiple currencies in one EA
- You can't use any predefined variables, can't use the tester, must poll (not OnTick,) and usually other problems, e.g A problem with iBarShift - MQL4 and MetaTrader 4 - MQL4 programming forum - Page 2
- Code it to trade the chart pair only. Look at the others if you must. (Don't assume that Time[i] == iTime(otherPair,tf, i) always use iBarShift.)
- Then put it on other charts to trade the other pairs. Done.
Thank you whroder1,
I would have really liked that to work. I didn't want to use enum with all the pairs mixed together in the one enum.
Thank you whroder1,
I would have really liked that to work. I didn't want to use enum with all the pairs mixed together in the one enum.
It looks like you want to iterate through a set of string values.
I am not sure why you (but not only you, it appears quite often here) attempt to use enum in place of a set or an array. Enum is a type definition, derived from the int type. It is not suitable for listing or iterating through its definition values. You do not use the enum as a type, which is the purpose of enum, but rather as a kinda set of string values.
You should create the string (or char) arrays and pass them and iterate them using the for loop.
Thanks Ex Ovo Ommia,
In the meantime I have been thinking about #include. I see a possible use of (#include <controls/ComboBox.mqh>) in my EA.
1) Have I over stepped the line.
2) Is it going to work.
ComboBox = Metal,etc
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello everyone,
How should I program this?
I can't see a way to get string "sym" to receive more than one enum value.
Example:
METAL selection is only Gold, or Silver
AUD selection is only AUD vs other pairing
EUR selection is only EUR vs other pairing
GBP selection is only GBP vs other pairing
USD selection is only USD vs other pairing