Function StrToTime causes error 4051 - page 3

 
The StrToTime and StringToTime functions are the same.
RaptorUK:
Why would I want compatibility with mql5 ? I'm using mql4 code for MT4.

I didn't say you must.
 
RaptorUK:
ResetLastError() before the StrToTime() call then call GetLastError() afterwards . . . StrToTime() shouldn't cause an error but it does . . . it's a bug. Something similar has already been acknowledged and fixed: https://www.mql5.com/en/forum/149475/page2


Is there anywhere in documentation written that StrToTime() uses error handler?

If not, than there is

1) No reason to check it

2) No reason to expect that the value returned has anything to do with result of StrToTime() function.

Also, what does err 4051 mean? Invalid lots amount?????

 
graziani:


Is there anywhere in documentation written that StrToTime() uses error handler?

If not, than there is

1) No reason to check it

2) No reason to expect that the value returned has anything to do with result of StrToTime() function.

Also, what does err 4051 mean? Invalid lots amount?????

This error can be generated by many functions, even those that do not return a value.

ERR_INVALID_FUNCTION_PARAMVALUE4051Invalid function parameter value.
 

Can you show me a reference in documentation where it is stated that StrToTime() uses error handler and that after the function is completed you should check for its success by calling GetLastError()?

 

anyway, there is one thing that we agree about, so lets rather make some noise about it:

Forcing that comments in EA source code after extern/input variables definition are visible as definition of variables in expert properties in strategy tester is arrogant, insolent and disrespectful towards programmers! MQ has no right to impose such rule and force users to waste time to change numerous lines of source and change commenting and source writing habits, in such a non-standard way. If they want such a non-standard behaviour, it should be implemented using #pragma directives, as this is the standard and accepted way.

 
graziani: it should be implemented using #pragma directives, as this is the standard and accepted way.
Or the more compact "standard and accepted ways" but still controlled by the coder.
Doxygen
int var; /*!< Detailed description after the member */
int var; //!< Brief description after the member
Or QT style
int var; /**< Detailed description after the member */
 
graziani:

Can you show me a reference in documentation where it is stated that StrToTime() uses error handler and that after the function is completed you should check for its success by calling GetLastError()?

Nope, I can't.

A similar situation has already been fixed with TerminalInfoString() . . . as I already mentioned. But I get your point, if the user used GetLastError() correctly the "error" would never have been seen.
 
graziani:

anyway, there is one thing that we agree about, so lets rather make some noise about it:

There is probably more than one thing we agree about
 
RaptorUK:
There is probably more than one thing we agree about

It seems. You can create a club
 
RaptorUK: Why would I want compatibility with mql5 ? I'm using mql4 code for MT4.
graziani: Str vs. String, you should use the new functions as they are same as in MQL5, to have source compatibility.
The mq4 documents have been updated. They are both in mt4. https://docs.mql4.com/convert/StrToTime and https://docs.mql4.com/convert/stringtotime
Reason: