mql4 function with Variable Arguments as c ?

To add comments, please log in or register
Davide Tedesco
136
Davide Tedesco  

Hi at all,

Is it possibile create a function/method use Variable Arguments as c language ?

Or using library ? which? Anyone know a good library for this scope ?

Or another way for create a function with dynamic number of pamaters input ?

Thanks at all !

Davide Tedesco
136
Davide Tedesco  

another way to use an array.

But with this choice i must set all parameters before call function, and read all in parameters in function.

Abir Pathak
163
Abir Pathak  
Davide Tedesco:

another way to use an array.

But with this choice i must set all parameters before call function, and read all in parameters in function.

No, dynamic number of arguments is not allowed in functions.

So, your best bet is to use a dynamic array or a structure. Since arrays and structures are passed by reference, you can keep it dynamic and keep incrementing array values as required.

If you are looking for same function having different types of arguments, you can even try function overloading:

https://docs.mql4.com/basis/function/functionoverload

Function Overloading - Functions - Language Basics - MQL4 Reference
Function Overloading - Functions - Language Basics - MQL4 Reference
  • docs.mql4.com
Usually the function name tends to reflect its main purpose. As a rule, readable programs contain various well selected identifiers. Sometimes different functions are used for the same purposes. Let's consider, for example, a function that calculates the average value of an array of double precision numbers and the same function, but operating...
To add comments, please log in or register