Use enumerations. Have an input which is an enumeration that serves as an index into an array of a structure which holds the parameter values.
Then in the OnInit() handler, read the values from the indexed array and apply them to the respective internal parameter variables.
Code sample ...
//Define the enumeration enum EParamSet { EPS_Set1 = 0, // Set 1 (10, 13, 23) EPS_Set2 // Set 2 (4, 13, 98) }; // Define the input variable for parameter set selection input EParamSet i_eParamSet = EPS_Set1; // Select the parameter set // Define parameter set structure struct SParamSet { int nParam1, nParam2, nParam3; }; // Declare global array of parameter sets SParamSet g_aParamSets[] = { { 10, 13, 23 }, { 4, 13, 98 } }; // Declare internal parameters int g_nParam1, g_nParam2, g_nParam3; // Handle the initialisation int OnInit() { g_nParam1 = g_aParamSets[ i_eParamSet ].nParam1; g_nParam2 = g_aParamSets[ i_eParamSet ].nParam2; g_nParam3 = g_aParamSets[ i_eParamSet ].nParam3; Print( "Parameters: ", g_nParam1, ", ", g_nParam2, ", ", g_nParam3 ); return(INIT_SUCCEEDED); };
Log output sample for different runs ...
2025.01.08 12:53:12.763 TestParamSet (EURUSD,H1) Parameters: 10, 13, 23 2025.01.08 12:53:44.371 TestParamSet (EURUSD,H1) Parameters: 4, 13, 98
Sample screenshot of input selection ...
Now adjust it according to your needs.
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

Hello everyone,
I’m working on an Expert Advisor in MQL5 and I’d like to add a feature where the user can select a predefined set of parameters from a dropdown input.
Here’s what I’m trying to achieve:
Current Setup
I have three parameters in my EA:
int Parameter1; int Parameter2; int Parameter3; (there are invisible to the user)
I want to create an input, visible to the user, that lets them select a predefined "trading set." For example:
Set 1 :
Set 2 :
When the user selects a set, the corresponding values for the parameters should be automatically assigned.
How can I implement this into a MT5 trading bot ?
Thanks in advance for your help!