How to change input menu options using drop down menu

 

How can I create an indicator that has multiple MAs, but not showing all the MA options at once, but instead revealing the settings for the MA chosen by the first drop down menu?


Would I use something like this?

enum MAchoice
{
MA1, // blah
MA2, // blah
MA3, // blah
};

input MAchoice MAmethod = MA1; // MA Method

switch (MAmethod)
{
case MA1: return(input int MA1period = 21; // MA1 Period; && input ENUM_MA_METHOD MA1method = MODE_EMA; // MA1 MA Method; && [applied price input] && [etc]);
case MA2: return([same as above, but changing the settings depending on what type of MA used]);
};

Would that work? This is just what I think would work. I haven't tried it, yet. If anyone has a better solution that works, lemme know. Much appreciated.

 
Nicholas C Weber: How can I create an indicator that has multiple MAs, but not showing all the MA options at once, but instead revealing the settings for the MA chosen by the first drop down menu? Would I use something like this? Would that work? This is just what I think would work. I haven't tried it, yet. If anyone has a better solution that works, lemme know. Much appreciated.

Not possible. MQL does not support dynamically selectable parameters for MQL programs. All parameters declaration are presented.

 
Fernando Carreiro #:

Not possible. MQL does not support dynamically selectable parameters for MQL programs. All parameters declaration are presented.

Sadly you are correct it seems, compiler error is received saying:
"'switch' - expressions are not allowed on a global scope asdf.mq5 42 1"

Though I feel like I tried an indicator that did just that some months back. I just wish I remembered what the heck that indicator was so I could peek inside the code.
 
Nicholas C Weber #: Though I feel like I tried an indicator that did just that some months back. I just wish I remembered what the heck that indicator was so I could peek inside the code.

You must be mistaken. What you might of seen was a program that created their your own graphics panel for inputs which appears AFTER the standard parameters Properties dialogue box.

 
Nicholas C Weber #:

Sadly you are correct it seems, compiler error is received saying:
"'switch' - expressions are not allowed on a global scope asdf.mq5 42 1"

Though I feel like I tried an indicator that did just that some months back. I just wish I remembered what the heck that indicator was so I could peek inside the code.

You have to code your own "css" so to speak for this . or your own jQuerry to be more precise .

There was a Russian that underwent the endeavor of building his own gui system if i recall .