doesnt show anything in [CalendarValueHistory]

 
When i try this code to get the number of events;

It doesnt give any results in strategy tester but it works in real data. Why doesnt it give any data in the backtest? How can i fix my code? Thanks
void OnTick()
{
   datetime start_of_day = iTime(_Symbol, PERIOD_D1, 0);
   datetime end_of_day = start_of_day + PeriodSeconds(PERIOD_D1);

   int event_count = GetEvents(start_of_day, end_of_day, NULL, "NZD");
   if(event_count < 1){
      return;
   }else{
      Print("event_count:"+event_count);
   }  
     
}

//// CALENDAR
int GetEvents(datetime fromTime, datetime toTime, string code = NULL, string currency = NULL){
   
   MqlCalendarValue values[];
   int events_count = 0;
   if(!CalendarValueHistory(values, fromTime, toTime, code, currency))
   {
      Print("CalendarValueHistory doesnt show any event: ", GetLastError());
      return -1;
   }
   else
   {
      events_count = ArraySize(values);
      if(events_count>0){
         MqlCalendarEvent event;
         CalendarEventById(values[0].event_id,event);
         Print("event:",event.name," -> code:",event.event_code, " -> importance ",event.importance, 
         " -> frequency ",event.frequency," -> digits ",event.digits," -> multiplier ",event.multiplier," -> sector ",event.sector);
         
         Print("events_count: ", events_count);
         Print("fromTime,toTime: ", fromTime, toTime);
      }
      
   }
   return events_count;
}

 
Huseyin Furkan Ozturk:
When i try this code to get the number of events;

It doesnt give any results in strategy tester but it works in real data. Why doesnt it give any data in the backtest? How can i fix my code? Thanks

The calendar functions don't work in the strategy tester.