ENUM symbol of pair

2 June 2017, 08:46
Jatin Patel
0
378
enum SYMBOLS_OF_PAIR
{
"EURCHF;CHFJPY;EURJPY",
"GBPCHF;CHFJPY;GBPJPY",
"USDCHF;CHFJPY;USDJPY",
"EURGBP;GBPCHF;EURCHF",
"EURUSD;USDCHF;EURCHF",
"EURGBP;GBPJPY;EURJPY",
"EURGBP;GBPUSD;EURUSD",
"EURUSD;USDJPY;EURJPY",
"GBPUSD;USDCHF;GBPCHF",
"GBPUSD;USDJPY;GBPJPY", 
};



There isn't any way, you have to code it.
If it's not going to be an input, I use this pattern
enumENUM_FRUIT {APPLE, BANANA, GRAPE,
                 FRUIT_FIRST=APPLE, FRUIT_LAST=GRAPE};
for(ENUM_FRUIT i = APPLE; i <= FRUIT_LAST; ++i) {
  Print(EnumToString(i));
}
Using it with an increment (++i) assumes they are adjacent numerically.
If it is going to be an input, I use this pattern
enumENUM_FRUIT {APPLE, BANANA, GRAPE}
#defineFRUIT_FIRST APPLE
#defineFRUIT_LAST  GRAPE
for(ENUM_FRUIT i = APPLE; i <= FRUIT_LAST; ++i) {
  Print(EnumToString(i));
}
 If they aren't numerically adjacent
 
constENUM_TIMEFRAMES  gcPeriods[]={  PERIOD_CURRENT,
  PERIOD_M1,  PERIOD_M2,  PERIOD_M3,  PERIOD_M4,  PERIOD_M5,  PERIOD_M6,
  PERIOD_M10,PERIOD_M12,PERIOD_M15,PERIOD_M20,PERIOD_M30,PERIOD_H1,
  PERIOD_H2,  PERIOD_H3,  PERIOD_H4,  PERIOD_H6,  PERIOD_H8,  PERIOD_H12,
  PERIOD_D1,  PERIOD_W1,  PERIOD_MN1};
ENUM_TIMEFRAMES  next(ENUM_TIMEFRAMEScurr){
  for(inti=0; gcPeriods[i] != curr; ++i){}
  returngcPeriods[i+1];
}