You're reading...
EA development, MQL4, MQL5

MQL: Making your extern inputs as a dropdown list of fixed options

A quick script illustrating making your extern inputs as a dropdown list of fixed options.

#property script_show_inputs
 
//Example 1
enum intOptionsA{
   A1 = 1,
   A2 = 2,
   A3 = 3,
};
 
input intOptionsA yourInputA = A1;
 
//Example 2
//added Comments which will appear as text options in the drop-down list
enum intOptionsB{
   B1 = 1, //One Duck
   B2 = 2, //Two Chickens
   B3 = 3, //Three Cows
};
 
input intOptionsB yourInputB = B2;
 
//Example 3
enum dayOfWeek{
   S  = 0, // Sunday
   M  = 1, // Monday
   T  = 2, // Tuesday
   W  = 3, // Wednesday
   Th = 4, // Thursday
   Fr = 5, // Friday
   St = 6, // Saturday
};
 
input dayOfWeek swapday = W;
 
void OnStart(){
   Print("yourInputA: ", yourInputA);
   Print("yourInputB: ", yourInputB);
   Print("swapday: ", swapday);
}

This is what will be seen.

Discussion

2 thoughts on “MQL: Making your extern inputs as a dropdown list of fixed options

  1. Thanks!

    your explanation was wonderfully clear and easy to understand, thank you!

    Posted by Cesar Afif Rezende Oaquim | 2018-04-11, 10:37 AM

Leave a comment

Archives

Visitors

Flag Counter