defining function with default params

 
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
 
No, sorry. Parameters with default values are impossible in library functions. You can declare defaults but You must pass all parameters explicitly
 
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 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).