You have to define a second function with an int as parameter. Or eventually use a template.
hardhu:
Hello everybody,
in my code I use a function that calculates the average value of an array of type double:
The problem I have is that then I need to apply them to an array of type int, as for example:
But when I compile it I get an error saying that parameter conversion is not allowed. How could I get rid of this? I was thinking about defining a new array of type double and then assigning to it the values of the previous array, and then calculating the average on this array, but this seems quite abstruse to me:
angevoyageur:
You have to define a second function with an int as parameter. Or eventually use a template.
Thanks a lot. Could function templates be put in an .mqh file to include in the Expert Advisor?
You have to define a second function with an int as parameter. Or eventually use a template.
hardhu:
Thanks a lot. Could function templates be put in an .mqh file to include in the Expert Advisor?
Of course.
Thanks a lot. Could function templates be put in an .mqh file to include in the Expert Advisor?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hello everybody,
in my code I use a function that calculates the average value of an array of type double:
The problem I have is that then I need to apply them to an array of type int, as for example:
But when I compile it I get an error saying that parameter conversion is not allowed. How could I get rid of this? I was thinking about defining a new array of type double and then assigning to it the values of the previous array, and then calculating the average on this array, but this seems quite abstruse to me: