You can't do that directly in MQL. But you can write a function with several last parameters having default value. Also you may define multiple functions with the same name but different parameter list.
You can't do that directly in MQL. But you can write a function with several last parameters having default value. Also you may define multiple functions with the same name but different parameter list.
Hi,
as of 2022, is this still true? :/ Giving my attempts, it seems so, but I may be doing it wrong.
There are no variadic functions.
See the following:
Define Variadic Arguments in Functions? - Bollinger Bands, BB - Expert Advisors and Automated Trading - MQL5 programming forum (2018)
Function with variable number of parameters - MQL4 programming forum (2018)
Different Indicators Parameters to iCustom - MQL5 programming forum (2020)
There have been no changes and it still holds true.
Sad. I hope someday they will add this possibility :T
There are no variadic functions.
See the following:
Define Variadic Arguments in Functions? - Bollinger Bands, BB - Expert Advisors and Automated Trading - MQL5 programming forum (2018)
Function with variable number of parameters - MQL4 programming forum (2018)
Different Indicators Parameters to iCustom - MQL5 programming forum (2020)
Thanks!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
I want to know how the Print(...) function was coded, because I want to write such a function myself,
which takes infinite number of parameters.
Does anyone know?