how to define parameters that users can choose value from DropDownList

 

hi every one

I want to define an extern parameter in an EA and I want put some value on it like:

1

1.1

1.2

1.3 , ....

that user can select one of them from DropDownList how I can do it?

Best Regards

Neda

 
enum blahblah
{
A,
B,
};

input blahblah Blah = A;

 
Hossein Zandi:

thanks alot

 
Hossein Zandi:

hi

I define like :

enum RiskPercent
{
1,1.1,1.2,1.3,1.4,1.5,1.6,1.7,1.8,1.9,2

};

input RiskPercent Risk = 1;

but it makes an error:


'1' - cannot convert enum   

 
Duplicate topic deteted.
 
enum ENUM_RISK_PERCENT
  {
   RISK_10=10, // 1.0
   RISK_11=11, // 1.1
   ...
   RISK_20=20, // 2.0
  };

input ENUM_RISK_PERCENT InpRisk = RISK_10; // Risk in Percent

double Risk = (double)InpRisk*0.1;
You cannot define an enum with floating point values, only int. But you can transform the enum into the right percentage range. The comments will give all inputs the proper label.
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
Documentation on MQL5: Constants, Enumerations and Structures / Environment State / Symbol Properties
  • www.mql5.com
To obtain the current market information there are several functions: SymbolInfoInteger(), SymbolInfoDouble() and SymbolInfoString(). The first parameter is the symbol name, the values of the second function parameter can be one of the identifiers of ENUM_SYMBOL_INFO_INTEGER, ENUM_SYMBOL_INFO_DOUBLE and ENUM_SYMBOL_INFO_STRING. Some symbols...
 
lippmaje:
You cannot define an enum with floating point values, only int. But you can transform the enum into the right percentage range. The comments will give all inputs the proper label.

thanks alot

it worked correctly

Reason: