CalendarEventById() failed to get event description for event [(non-string passed) error 5402]

 

Hello and greetings to you all potential helpers.

The error message log attached indicates 5402, which according to  CalendarEventById - Economic Calendar - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5, signifies: ERR_CALENDAR_NO_DATA (country is not found).

The error emanated from a processing sequence of the MqlCalendar functions:

1.) CalendarValueHistory() to retrieve all events for a chosen currency, within a specified time range, and write them to an array -values[] - of MqlCalendarValue structures.

2.) CalendarEventById() uses the retrieved values.id from each values[] array entry to get the calendar event importance (or priority) and other parameters of interest.

The ultimate goal of the code is to filter each event according to the "parameters of interest"; however, the second function is unable to retrieve the attributes.

Please see the attached files for better clarification. Your aid is heartily appreciated, thank you.

Documentation on MQL5: Economic Calendar / CalendarEventById
Documentation on MQL5: Economic Calendar / CalendarEventById
  • www.mql5.com
CalendarEventById - Economic Calendar - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Files:
20230331.log  36 kb
test1.mq5  3 kb
 
Valentine Ozoigboanugo:

Hello and greetings to you all potential helpers.

The error message log attached indicates 5402, which according to  CalendarEventById - Economic Calendar - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5, signifies: ERR_CALENDAR_NO_DATA (country is not found).

The error emanated from a processing sequence of the MqlCalendar functions:

1.) CalendarValueHistory() to retrieve all events for a chosen currency, within a specified time range, and write them to an array -values[] - of MqlCalendarValue structures.

2.) CalendarEventById() uses the retrieved values.id from each values[] array entry to get the calendar event importance (or priority) and other parameters of interest.

The ultimate goal of the code is to filter each event according to the "parameters of interest"; however, the second function is unable to retrieve the attributes.

Please see the attached files for better clarification. Your aid is heartily appreciated, thank you.

An ex5 is of no help. You need to provide source code (mq5), the minimum to reproduce the issue.
 
Alain Verleyen #:
An ex5 is of no help. You need to provide source code (mq5), the minimum to reproduce the issue.
That was an unintended mistake, sorry. It's corrected now.
 
Valentine Ozoigboanugo #:
That was an unintended mistake, sorry. It's corrected now.
ulong id = values[r].event_id;//gets value ID
 

fxsaber #:

Unbelievable! nerve-racking problem solved with just six characters!. I must go back to calling me a beginner.

This is amazing, thanks.