EA news problem

 

I need the values: - news date and time (USD) - news impact type (USD) from uses in EA


in the code i used string date=values[1] string impact=values[8] but it gives me error illegal operation use


void  OnTick()
  {
//--- codice Paese per EU (ISO 3166-1 Alpha-2)
   string EU_code="US";
//--- ottiene tutti i valori degli eventi EU
   MqlCalendarValue values[];
//--- imposta i limiti dell'intervallo da cui prendiamo gli eventi
   datetime date_from=D'23.07.2023';  // prende tutti gli eventi dal 2018
   datetime date_to=0;                // 0 indica tutti gli eventi noti, inclusi quelli che non si sono ancora verificati 
//--- richiede la cronologia degli eventi dell'UE dall'anno 2018 
   if(CalendarValueHistory(values,date_from,date_to,EU_code))
    {
      PrintFormat("Valori evento ricevuti per country_code=%s: %d",
                  EU_code,ArraySize(values));
      //--- riduce la grandezza dell'array per l'output sul Journal
      ArrayResize(values,10);
//--- visualizza i valori degli eventi nel Journal
     // ArrayPrint(values);
      ArrayPrint(values);
      

      
     }
   else
    {
      PrintFormat("Errore! Impossibile ricevere eventi per country_code=%s",EU_code);
      PrintFormat("Codice errore: %d",GetLastError());
     }
//---
  }
/*
  Risultato:
  Valori evento ricevuti per country_code=EU: 1384
        [id] [event_id]           [time]               [period] [revision]   [actual_value] [prev_value] [revised_prev_value] [forecast_value] [impact_type] [reserved]
   [0] 54215  999500001 2018.01.02 09:00:00 2017.12.01 00:00:00          3       60600000     60600000 -9223372036854775808         60500000             1          0
   [1] 54221  999500002 2018.01.04 09:00:00 2017.12.01 00:00:00          3       56600000     56500000 -9223372036854775808         56000000             1          0
   [2] 54222  999500003 2018.01.04 09:00:00 2017.12.01 00:00:00          3       58100000     58000000 -9223372036854775808         58400000             2          0
   [3] 45123  999030005 2018.01.05 10:00:00 2017.11.01 00:00:00          0         600000       400000 -9223372036854775808           100000             1          0
   [4] 45124  999030006 2018.01.05 10:00:00 2017.11.01 00:00:00          0        2800000      2500000 -9223372036854775808          1500000             1          0
   [5] 45125  999030012 2018.01.05 10:00:00 2017.12.01 00:00:00          1         900000       900000 -9223372036854775808          1000000             2          0
   [6] 45126  999030013 2018.01.05 10:00:00 2017.12.01 00:00:00          1        1400000      1500000 -9223372036854775808          1500000             2          0
   [7] 54953  999520001 2018.01.05 20:30:00 2018.01.02 00:00:00          0      127900000     92100000 -9223372036854775808         76400000             0          0
   [8] 22230  999040003 2018.01.08 10:00:00 2017.12.01 00:00:00          0        9100000      8200000              8100000          7600000             1          0
   [9] 22231  999040004 2018.01.08 10:00:00 2017.12.01 00:00:00          0       18400000     16300000             16400000         16800000             1          0   
*/
 
SergioTForex:

I need the values: - news date and time (USD) - news impact type (USD) from uses in EA

in the code i used string date=values[1] string impact=values[8] but it gives me error illegal operation use

Of course, it does. Each values is a structure. Perhaps you should read the manual. Economic Сalendar structures - Data Structures - Constants, Enumerations and Structures - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
   How To Ask Questions The Smart Way. (2004)
      How To Interpret Answers.
         RTFM and STFW: How To Tell You've Seriously Screwed Up.
string date=values[1].time; string impact=values[1].impact_type;