setting library function parameters to default. Is this ok?

 

I have this function stored as library function. It is import in a header file:

double  hseGambit(double aPrice[], double bPrice[], int deal1=0, int deal2=0, int players=-1);

My question is about those 3 int parameters (highlighted in red) set to respective default values. If the EA call the fuction eg:

hseGambit(High,Low, 1, 5, 4);

Will this work well, and also during testing? And will this work well?

hseGambit(High, Low);

Thx.

 
Try it and find out. I seem to recall someone posted that default parameters do not work in DLLs.
 
WHRoeder:
Try it and find out. I seem to recall someone posted that default parameters do not work in DLLs.

I was searching hi and low, cant find anything. I tried and it does seem not to work, for some unbeknowned reasons....

 

diostar:

[...] Will this work well, and also during testing? And will this work well?

The MQ4 documentation says that your second example ( hseGambit(High, Low); ) isn't going to compile. The page at https://docs.mql4.com/basis/variables/formal says "MQL4-library functions imported within other modules cannot have parameters initialized by default values"

In other words, you can have functions with optional parameters in a MQH file (which you #include) but not in a EX4 library or DLL (which you #import).

 
jjc:

The MQ4 documentation says that your second example ( hseGambit(High, Low); ) isn't going to compile. The page at https://docs.mql4.com/basis/variables/formal says "MQL4-library functions imported within other modules cannot have parameters initialized by default values"

In other words, you can have functions with optional parameters in a MQH file (which you #include) but not in a EX4 library or DLL (which you #import).

Thx, that is the link I needed to search. Appreciate this.;-)
Reason: