Libraries: Calendar - page 13

 

Forum on trading, automated trading systems and testing trading strategies

Libraries: Calendar

TradingProFX, 2024.10.30 13:12

if (MQLInfoInteger(MQL_TESTER)) // If working in Tester
{
      Res = Calendar.Load(CALENDAR_FILENAME);
      Print ("SIZE = ", Calendar.Set(NULL,CALENDAR_IMPORTANCE_NONE, 0, 0));
...

Why do I get 0 in the tester?

Zero To-parameter.

 
Set() method for MT5 only. How to initialise and download news for MT4?
 
mbjen #:
Set() method for MT5 only. How to initialise and download news for MT4?

How is it done for MT5 tester.

 
Calendar.Load(CALENDAR_FILENAME);
Calendar.FilterByCurrency(Symbol());

After Load I get: CALENDAR{ Events:[197684] }

And after FilterByCurrency: CALENDAR{ Events:[] }


Symbol() = EURUSD

 
mbjen EURUSD

I don't understand anything. Attach compiled mq4/5.

 
fxsaber #:

I don't understand anything. Attach compiled mq4/5.

FilterByCurrency does not work. An empty array is received after calling FilterByCurrency().

The code is simple

#include <Calendar\Calendar.mqh>

#define CALENDAR_FILENAME "Calendar.bin"

CALENDAR                   Calendar;

if(DownloadCalendar())
        {
         Calendar.Load(CALENDAR_FILENAME);
         Calendar.FilterByCurrency(Symbol());
        }

After Calendar.Load in the debugger I see CALENDAR{ Events:[197684] }
And after Calendar.FilterByCurrency(Symbol()): CALENDAR{ Events:[] }

 
if(DownloadCalendar())
        {
         Calendar.Load(CALENDAR_FILENAME);
         int size=Calendar.GetAmount();
         Print("size: ", size);
         Calendar.FilterByCurrency(Symbol());
         size=Calendar.GetAmount();
         Print("size: ", size);
        }

2025.04.02 21:59:59.444 EURUSD,H1: size: 0
2025.04.02 21:59:56.772 EURUSD,H1: size: 197684

 
mbjen #:

An empty array is obtained after calling FilterByCurrency().

This is a filter by currency, not by symbol.


Open Calendar.mqh in ME and press ALT+M.


 
>

This is a filter by currency, not by character.


got it

 

Hello. Is it possible to shift the calendar to a certain time?

The calendar is downloaded in one terminal (with one timezone), but will be used (MT4) in a terminal with a different timezone. It turns out that it is necessary to correct the time in the calendar somehow.