Changing input for multiple-choice in EA/Indicators

Post Reply
VirtualFM
Trader
Posts: 84
Joined: Sat Apr 28, 2012 3:45 am

Changing input for multiple-choice in EA/Indicators

Post by VirtualFM »

Hi guys!

I've been following the progress made in this forum since it's early beginning. It's amazing the quantity of inspiring ideas and incredible tools that were freely put at the disposal of mere mortals.

However there is something that really bothers me: the way we input timeframes in the EA's parameters (and other multiple choice parameters, but mainly the timeframes)

You see, among the bunch of parameters we have to input (well, we don't HAVE to, but as someone who likes to experiment, as I'm sure most of you feel the same, I try a bunch of stuff and change a lot of parameters) one of the most recurrently changes are timeframes. Timeframes for CSS, timeframes for entry points, timeframes for ATR calculations, timeframes for MAs, timeframes for Slope (there's a bunch of them for Baluda's SuperSlope), etc

The methods are usually either by entering a number in minutes (60, 240, 1440, ...), sometimes with a comment above with a reminder of the available periods, so sometimes it it looks like this:
TimeframeExample1.PNG
some other times like this
TimeframeExample2.PNG
and more recently like this:
TimeframeExample3.PNG
Even if we quickly learn the nomenclature, I find it utterly cumbersome to constantly change H4 to H1 then to D1 then to whatever, or inputing 60/240/1440.. I don't know which method I hate the most!

So, in the spirit of sharing, that is what makes this forum so delightful, I don't want to only share my complaints with you, so I want to point to a solution for the consideration of the major contributors that make the most available tools.

OK, AFAIK natively we only have a standard drop-down menu for booleans. It's quick to select True/False, right? What about use the same type of drop-down menus for other common selections, like major currencies, text font size, maybe some standard colours and... ta-daaaa!... Timeframes!

In order to do that we only need to define a list of possible values through "enum", which are assigned a number. Later the program takes decisions based on that number (user selection).

In the Empty4 documentation there is an example with a list of months:

https://docs.mql4.com/basis/types/integer/enumeration

In terms of timeframes this will allow to this:
TimeframeExampleOK.PNG
So, if you like the idea, please take in consideration on future releases. It actually doesn't take long to code, and once it's done it can be used in future Indicators/EAs.

In attachment I add an example (an EA that does nothing except displaying a different message depending on your parameter choices, so you add the EA, press F7, change the parameters, read the message, press F7, etc) where I have a longer list of choices (and use a switch/case command for decision-making) and a shorter list used for readability (using simple IF commands).

PS: Now if someone put this as a Pull-Down menu right there ON THE CHART... boy, I would send him/her a bottle of wine!
You do not have the required permissions to view the files attached to this post.
Post Reply

Return to “Coders Hangout”