Hi,
the editor in build >600 doesn't like the function StrToTime.
Calling it causes the error 4051. What's wrong??
code is here:
<deleted>
OK, now I know... next time...
do you have a solution for my problem?
//+------------------------------------------------------------------+ //| test.mq4 | //+------------------------------------------------------------------+ #property version "1.00" //--- input parameters input string TimeClose_="21:45"; //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- datetime xxxxx = StrToTime("21:45"); Print("error: "+GetLastError()); } //+------------------------------------------------------------------+
- Next time edit your original post.
- Don't call GetLastError() unless you have an error. Is xxxx == 0? Why didn't you print it along with GLE?
datetime xxxxx = StrToTime("21:45"); Print("error: "+GetLastError());
test EURUSD,H1: error: 4051 - Perhaps you should try the new StringToTime
OK, now I know... next time...
do you have a solution for my problem?
It might have been fixed . . . https://www.mql5.com/en/forum/149475 but please report it to the Service Desk anyway.
- Next time edit your original post.
- test EURUSD,H1: error: 4051Don't call GetLastError() unless you have an error. Is xxxx == 0? Why didn't you print it along with GLE?
- Perhaps you should try the new StringToTime
@2: how should i find out if there is an error, if i do not ask GLE?
This code is to find out, why my EA is giving error-messages. No other purpose.
@3: the StringToTime causes the same error :(
Is there an other possibility?
GLE does not tell you IF you have an error. It tells you what the error is WHEN you have one.
GLE returns the last error code. That code is associated with what code? Unknown. Could have been something associated with internal terminal processing or a call from a previous function you called.
D'21:45'
That is not a string, that is a datetime already (21:45 of the day you compiled the code.)
Read the doc StrToTime()
datetime var1; var1=StrToTime("2003.8.12 17:35"); var1=StrToTime("17:35"); // returns the current date with the given time var1=StrToTime("2003.8.12"); // returns the date with the midnight time of "00:00"
PERFECT ! Now its runs without an error =)
It must be the complete date-format!
TNX a lot!!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
the editor in build >600 doesn't like the function StrToTime.
Calling it causes the error 4051. What's wrong??
code is here:
The result with every tick:What's wrong here. Compilation with editor 509 causes no error, of course