//+------------------------------------------------------------------+ //| news.mq5 | //| Copyright 2000-2026, MetaQuotes Ltd. | //| www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2000-2026, MetaQuotes Ltd." #property link "https://www.mql5.com" //--- #property script_show_inputs //--- input string symbol = "EURUSD"; // Market symbol for analysis input string country1 = "US"; // first news source input string country2 = "EU"; // second news source input datetime from_t = D'2024.04.01'; // Start of analysis time interval input datetime to_t = D'2026.04.01'; // End of analysis time interval //--- #include "EconometricsM.mqh" //--- const datetime SECONDS_IN_DAY=24*60*60; //--- //+------------------------------------------------------------------+ //| to get full list events ids for country use events2file.mq5 | //+------------------------------------------------------------------+ ulong events_ids1[]= {840010007,840020001,840030006,840030015,840050014}; ulong events_ids2[]= {999010007,999030010,999030016,999030018,999030020}; //-- void OnStart() { //--- quotes downloading MqlRates rates[]; int n_rates = CopyRates(symbol, PERIOD_D1, from_t, to_t, rates); PrintFormat("Number of downloaded quotes for market symbol %s: %d", symbol, n_rates); if(n_rates < 2) return; //--- news days downloading datetime days1[],days2[]; news_days(from_t,to_t,country1,events_ids1,days1); news_days(from_t,to_t,country2,events_ids2,days2); PrintFormat("Number of days with news for region %s: %d",country1,ArraySize(days1)); PrintFormat("Number of days with news for region %s: %d",country2,ArraySize(days2)); Print("*******************************************************"); //--- y and X calculation ulong n=n_rates; vector y(n); datetime t; int it; matrix X=matrix::Full(n,3,0.0); for(ulong i=0;i0) ArraySort(days); } //+------------------------------------------------------------------+