below complete code:
/*
int minbeforeEvent = 6024;
int minAfterEvent = 6024;
string currency_code = "";
string country_code=NULL; //--- country code (ISO 3166-1 Alpha-2)
ENUM_CALENDAR_EVENT_IMPORTANCE min_event_importance = CALENDAR_IMPORTANCE_HIGH;
*/
int FilteredEventsCount = 0;
MqlCalendarValue values[];
//--- set the boundaries of the interval we take the events from
datetime date_from=TimeCurrent() - (60minbeforeEvent);
datetime date_to=TimeCurrent() + (60minAfterEvent); // 0 means all known events, including the ones that have not occurred yet
//Print(TimeToString(TimeCurrent(), TIME_DATE|TIME_SECONDS), " -> Searching from ", TimeToString(date_from, TIME_DATE|TIME_SECONDS), " to ", TimeToString(date_to,TIME_DATE|TIME_SECONDS));
//--- request event history since the beginning to future time
//if(verbose) Print("Begin Searching for events from " + TimeToString(date_from,TIME_DATE|TIME_SECONDS) + " to " + TimeToString(date_to,TIME_DATE|TIME_SECONDS) + " For Country " + country_code + ", currency " + currency_code );
if(!CalendarValueHistory(values, date_from, 0, country_code, currency_code))
{
PrintFormat("Error! Failed to get events for country_code=(%s), currency=(%s)", country_code, currency_code);
PrintFormat("Error code: %d", GetLastError());
} else {
//if(verbose) Print("Found some events");
//PrintFormat("Received event values for country_code=(%s), currency=(%s) is (%d)", country_code, currency_code, ArraySize(values));
int total=ArraySize(values);
string commentString = "";
for(int i=0; i<total; i++)
{
//if(values[i].impact_type < )
MqlCalendarEvent event;
ulong event_id=values[i].event_id;
if(CalendarEventById(event_id,event))
{
if(((ENUM_CALENDAR_EVENT_IMPORTANCE)event.importance >= min_event_importance )
&& (values[i].time <= date_to)
)
{
FilteredEventsCount++;
commentString = commentString + TimeToString(values[i].time,TIME_DATE|TIME_SECONDS) + " " + event.name + " " + EnumToString((ENUM_CALENDAR_EVENT_IMPORTANCE)event.importance ) + "\n";
}
}
}
commentString = "MQL5 returned " + FilteredEventsCount + " events from " + TimeToString(date_from,TIME_DATE|TIME_SECONDS) + " to " + TimeToString(date_to,TIME_DATE|TIME_SECONDS) + " For Country " + country_code + ", currency " + currency_code + "\n" + commentString;
if(verbose) Comment(commentString);
}
if( FilteredEventsCount > 0 )
{~next~}
else
{~inext~}
BELOW, CODE TO INSERT IN GLOBAL VARIABLES:
string event_info = "";
AND, NEED CREAT THIS:

BELOW CONFIGURATIONS:






AND TO FINISH INSERT THIS BUTTON CREATED IN ON TICK OR ON TIMER

Hope this helps someone.








