Input Parameters in MetaTrader Programs

As an MQL4 and MQL5 developer, you may often wonder — what is the best way of presenting the input parameters to control the behavior of indicatorsexpert advisors, and scripts you create? Input parameters are vitally important — Forex traders should easily understand which one does what. If you make input parameters too complex — users will flood you with questions. However, the MetaTrader platform has its own limits for the inputs' descriptions. Moreover, fitting complete user manuals into the settings form will decrease usability for experienced traders. So, which option is the best?

Hardcore MQL developers (who code mostly for themselves) prefer obscure input parameter names. Such names contain little to no information that could be useful to laymen. Consider this set of inputs from a popular MT4 indicator Var Mov Avg:

MT4 indicator with obscure input parameter names

Only the last two parameters have names that would tell the end-user what they do. The rest is left to guesswork and trial and error.

The next step would be to call the parameters normal names. The majority of good developers do exactly this. Consider the list of inputs of Alligator (a standard MetaTrader indicator):

Alligator - MT4 indicator with descriptive input parameter names

Although it requires some basic understanding of what Alligator indicator is, it offers a clear picture for a potential user.

Luckily, MetaTrader allows inserting full textual descriptions as parameter names. There are two drawbacks though. First, the string length limit is just 63 characters. Second, without a name, it is difficult to refer to a parameter in the user documentation and to provide any additional info.

combination of parameter names and textual descriptions is a bit heavier but offers an advantage — you get a parameter name to refer to in the user documentation and you get an immediate description, albeit a short one, to provide some help inside the platform. Fitting into the platform's length limit becomes even more difficult.

The following screenshot shows some input parameters for the Position Size Calculator:

Position Size Calculator with inputs parameters containing both names with textual descriptions and bare textual descriptions

The first three parameters have visible names and a descriptive commentary. Alas, the text gets cut due to the platform's restrictions. The last two parameters lack the names but get to display full textual descriptions.

The most informative way of presenting the input parameters in MetaTrader is the multiline textual description. It requires some fiddling with the string parameters. The result is not anything elegant, and the input parameters form becomes quite bulky. However, this way, you can fit lots of text inside the form. This input parameters form for the Moving Average Candlesticks indicator demonstrates the concept:

Multiline descriptions of the indicator's input parameters

As you can see, the three lines above the last input parameter give an extensive description of its possible values.

It can be argued that the best way is to go with the names accompanied by descriptions in nearly all cases. When you reach the character limit, it is worth considering multiline descriptions. The important thing is to offer a compact inputs form with as much information as you can, but still to retain some means (parameter names) of providing detailed information in the program's manual or guide.

If you have some ideas on what is the best way to present a list of input parameters in MetaTrader programs, please share them on our Forex forum.


If you want to get news of the most recent updates to our guides or anything else related to Forex trading, you can subscribe to our monthly newsletter.

© 2005–2021

EarnForex.com

Design — Mart Studio

Forex trading bears intrinsic risks of loss. You must understand that Forex trading, while potentially profitable, can make you lose your money. Never trade with the money that you cannot afford to lose! Trading with leverage can wipe your account even faster.

CFDs are leveraged products and as such loses may be more than the initial invested capital. Trading in CFDs carry a high level of risk thus may not be appropriate for all investors.