I need to return a specific value based on _Symbol of current chart. It seems switch operator doesn't work with _Symbol. Thanks
- What does this IF condition mean?
- How to link my EA to my created signal?
- expert advisor - miscellaneous questions
Daniel Arges:
I need to return a specific value based on _Symbol of current chart. It seems switch operator doesn't work with _Symbol. Thanks
I need to return a specific value based on _Symbol of current chart. It seems switch operator doesn't work with _Symbol. Thanks
int SymbolValue(const string symbol) { if(StringFind(symbol,"EURUSD")>=0) return 1; if(StringFind(symbol,"USDJPY")>=0) return 2; ... }
or variations of:
enum SymbolIndex { SI_EURUSD, ..., SI_USDJPY}; #define SI_COUNT (SI_USDJPY+1) int symbol_to_index(const string symbol){ SymbolIndex si=SI_COUNT; while(--si != WRONG_VALUE){ string si_XXX = EnumToString(idx); // SI_XXX string xxx = StringSubstr(si_XXX, 3); // XXX if(StringFind(symbol,xxx)>=0) break; } return si; }
whroeder1:
or variations of:
or variations of:
Thank you all!

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