Apparently undocumented runtime error #4307, probably connected to "SymbolInfoSessionTrade(...)"

 

Hello dear MetaQuotes team,

it is certainly desirable for all users of the platform that every type of error that can occur is actually named in the documentation, since otherwise you are groping in the dark. Thanks in advance. Apart from that, thank you very much for this great platform.

If someone should know something more about the error #4307, I would be happy if someone wrote something enlightening about it, because neither a search on "mql5.com", on "metatrader5.com", nor on a general search engine yielded something useful about it. Thank you very much.
 
You should provide more information. Can you post the log where this error appears ? And the relevant code ?
 
Alain Verleyen:
You should provide more information. Can you post the log where this error appears ? And the relevant code ?

Hi Alain,

thanks for replying. Unfortunately the logs don't show anything special except my own generated entry with the "_LastError: 4307". The relevant call was just equivalent to:

datetime tFrom = 0, tTo = 0;
SymbolInfoSessionTrade("EURUSD", SUNDAY, 0, tFrom, tTo);

However, after this I compare the output of the "tFrom" with the output one week before in order to track eventual changes in the trading session. My generated warning showed a difference, along with the ominous errornumber. I wish I would have logged the actual value of "tFrom" to have one more hint, but I didn't. Oh, I do this for every weekday and a change only was logged for sunday. It happened on ActivTrades Demo yesterday evening around 9pm server time. Usually trading begins at 11pm on sunday. Thanks in advance for your effort.

 

Hi,

recently I made a small testscript with wich I found out, that the ominous error #4307 just seconds the failure of the call I mentioned, when the specified session does not exist. That's about all to say there besides the importance to really ignore the date output by this function. Thanks anyway - another problem solved.

Greetings

 
datetime tFrom = 0, tTo = 0;

if (SymbolInfoSessionTrade("EURUSD", SUNDAY, 0, tFrom, tTo))
{

        ResetLastError();
        return true

}
else 
{   // error 4307
        ResetLastError();
        return false 
}

If your coding is like this, the problem can be solved.
Reason: