Multiple Choice Constant?

 
I've googled and searched the forums, so sorry if this has already been answered and I don't know the correct search terms.

Instead of using bool true/false to change between only 2 parallel blocks(1 or the other), I'd like a way to choose from a multiple choice menu, like 1 thru 5, and each number correlates to a block that turns on and the others off by default.

Is this possible?

Or should I just have multiple true/false on init blocks and just manually turn off all but the one I want? (this would be the easiest to make, but the ugliest to look at and control in the finished EA.)

 
Nicholas C Weber:
I've googled and searched the forums, so sorry if this has already been answered and I don't know the correct search terms.

Instead of using bool true/false to change between only 2 parallel blocks(1 or the other), I'd like a way to choose from a multiple choice menu, like 1 thru 5, and each number correlates to a block that turns on and the others off by default.

Is this possible?

Or should I just have multiple true/false on init blocks and just manually turn off all but the one I want? (this would be the easiest to make, but the ugliest to look at and control in the finished EA.)

You can use enumeration

Documentation on MQL5: Language Basics / Data Types / Integer Types / Enumerations
Documentation on MQL5: Language Basics / Data Types / Integer Types / Enumerations
  • www.mql5.com
Enumerations - Integer Types - Data Types - Language Basics - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
 
Nicholas C Weber: I'd like a way to choose from a multiple choice menu, like 1 thru 5, and each number correlates to a block that turns on and the others off by default. Is this possible?

Of course, its possible.

enum Menu{ m_first,  // Choice1
           m_second, // Choice2
           ⋮
           m_last};  // Choicen
input Menu choice=m_first;
⋮
   switch (choice){
      case m_first:  doFirst(); break;
      case m_second: doSecond(); break;
      ⋮
   }