| //+------------------------------------------------------------------+
|
| //| Generador Archivos CSV Calendario.mq5 |
|
| //| Niquel |
|
| //| https://www.mql5.com |
|
| //+------------------------------------------------------------------+
|
| #property copyright "Niquel-Leo, 2024"
|
| #property link "https://www.mql5.com/en/users/nique_372"
|
| #property version "1.00"
|
| #property script_show_inputs
|
| #property strict
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| //#define RELEASE_VERSION
|
| #include "..\\..\\Secrets.mqh"
|
| #include <TSN\\FastNL\\Main.mqh>
|
| #include <TSN\\Std\\Basics\\Try.mqh>
|
|
|
| //+------------------------------------------------------------------+
|
| //| |
|
| //+------------------------------------------------------------------+
|
| sinput group "=== Settings Generator ==="
|
| input datetime fecha_desde_incio_noticias = D'2005.01.01';//Start date for calendar data collection
|
| input datetime hasta = 0; //Final para generar noticias (0 => Hasta el tiempo actual)
|
| input string importances_events = "High|Medium|Low|None"; //Importancias de los eventos separados por "|"
|
|
|
| //+------------------------------------------------------------------+
|
| //| Script program start function |
|
| //+------------------------------------------------------------------+
|
| void OnStart()
|
| {
|
|
|
| #ifdef TSN_FASTNL_FUNC_CTS
|
| TSN_FASTNL_FUNC_CTS(THE_BOT_PLACE_USER_ID);
|
| #else
|
| CiNewsLeo_CalendarInit(THE_BOT_PLACE_USER_ID);
|
| #endif // TSN_MCPSERVER_FUNC_CTS
|
|
|
| TSN::ICalendarByLeo* calendar = CiNewsLeo_CreateEconomicCalendar();
|
|
|
| datetime desde = fecha_desde_incio_noticias;
|
| datetime h = hasta == 0 ? TimeTradeServer() : hasta;
|
| //CiNewsLeo_AddLogFlags(LOG_ALL);
|
| Print(TimeToString(h));
|
|
|
| //---
|
| string _what = NULL;
|
| TSNSTD_TRY_INI
|
| {
|
| TSNSTD_TRY_EF(calendar.AddAllCountries(importances_events), true, CiNewsLeo_FormatTraceFirst(_what))
|
| TSNSTD_TRY_EF(calendar.SetCalendar(desde, h), true, CiNewsLeo_FormatTraceFirst(_what))
|
| TSNSTD_TRY_EF(calendar.GenerateFiles(), true, CiNewsLeo_FormatTraceFirst(_what))
|
| }
|
| TSNSTD_TRY_END
|
|
|
| //---
|
| if(_what != NULL)
|
| {
|
| FastLog(FUNCION_ACTUAL, FATAL_ERROR_TEXT, _what);
|
| }
|
|
|
| //---
|
| delete calendar;
|
| }
|
| //+------------------------------------------------------------------+
|