Error code 5402 is returned by CalendarEventById() function, if the event ID is "invalid".
This error is documented as
ERR_CALENDAR_NO_DATA
5402
Country is not found
I suspect, the error description is misleading. - This function is not even capable of verifying country ID. The event ID is non-existant, therefore it is not capable of even evaluating the country itself.
A better description of the error code would be: "No data found in calendar database".
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
@Rashid Umarov
ChartScreenshot() is not working in the Strategy Tester. It would be nice to add a word about it in the documentation : https://www.mql5.com/en/docs/chart_operations/chartscreenshot
And also to update the list of functions not working in the Tester : https://www.mql5.com/en/docs/runtime/testing#function_limitations
And finally to return an error : currently the function doesn't do anything silently.
ERR_FUNCTION_NOT_ALLOWED
4014
Function is not allowed for call
Forum on trading, automated trading systems and testing trading strategies
MetaTrader 5 Platform Update Build 5660: Improvements and Fixes
Vladislav Boyko, 2026.03.29 14:40
In the documentation, the parameter is of type int:
In the editor, the parameter is of type unit:
And the parameter name doesn't match.
Forum on trading, automated trading systems and testing trading strategies
Wrong error code description in documentation
Dominik Egert, 2026.05.05 09:33
Error code 5402 is returned by CalendarEventById() function, if the event ID is "invalid".
This error is documented as
ERR_CALENDAR_NO_DATA
5402
Country is not found
I suspect, the error description is misleading. - This function is not even capable of verifying country ID. The event ID is non-existant, therefore it is not capable of even evaluating the country itself.
A better description of the error code would be: "No data found in calendar database".