Hello metaquotes,
I'm trying to define a function in a library that has one default parameter at the end of the parameter list. When I write the code to call it omitting this last default parameter I get a compiler error "wrong parameter count".
My question: Is it or is it not possible to define a user defined function with default parameter(s)?
Thanks
Doji
I'm trying to define a function in a library that has one default parameter at the end of the parameter list. When I write the code to call it omitting this last default parameter I get a compiler error "wrong parameter count".
My question: Is it or is it not possible to define a user defined function with default parameter(s)?
Thanks
Doji
I think you can always have your own convention about the meaning of the parameters. In this case, you can, for sample, assign your last parameter to 0 or what you want in the meaning for the function to use insteed a defaut value.
Your function will contain something like this: if(LastPara == 0) LastPara = LastParaDefautValue; (assuming your goal is to define LastParaDefautValue only once in a library).
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
I'm trying to define a function in a library that has one default parameter at the end of the parameter list. When I write the code to call it omitting this last default parameter I get a compiler error "wrong parameter count".
My question: Is it or is it not possible to define a user defined function with default parameter(s)?
Thanks
Doji