Do you have PRTF.mqh? (file 'MQL5\Include\MQL5Book\PRTF.mqh' not found CalendarCache.mqh 7 11)
I found it https://www.mql5.com/en/code/45593
- www.mql5.com
Do you have PRTF.mqh? (file 'MQL5\Include\MQL5Book\PRTF.mqh' not found CalendarCache.mqh 7 11)
Thank you for pointing this out. This is an omission. I added the header to this indicator as well. I don't know how did it pass the automatic check-up during submission without this file.
- www.mql5.com
HI, i've a problem with adjustTZonHistory or with my code ;-) I tried to save the cache file with adjustTZonHistory and without adjustTZonHistory - but the news events are always wrong in the tester. Shifted by 1 hour or by 2 hours.
The code i used:
newsfilter_cache = new CalendarCache("calendar_cache.cal", true); if(newsfilter_cache[].isLoaded()) { Print("Newsfilter: using cache..."); newsfilter_filter = new CalendarFilterCached(newsfilter_cache[]); } else { if(MQLInfoInteger(MQL_TESTER)) { Alert("Can't run in the tester without calendar cache file"); Print("Can't run in the tester without calendar cache file"); return false; } newsfilter_cache = new CalendarCache(); newsfilter_cache[].adjustTZonHistory(_Symbol, true); if(!newsfilter_cache[].save("calendar_cache.cal")) { Print("Error: ", _LastError); }
Thanks for your help!
Output is:
2025.01.06 22:16:55.523 (EURUSD.PRO,M1) Binding calendar tables... 2025.01.06 22:16:55.587 Edge EA (EURUSD.PRO,M1) Time fix-up started at 2015.10.19 04:00:00 2025.01.06 22:16:55.587 Edge EA (EURUSD.PRO,M1) 2015.10.19 04:00:00: 57673 -10800 diff=-3600 2025.01.06 22:16:55.588 Edge EA (EURUSD.PRO,M1) 2015.12.20 23:00:00: 104987 -7200 OK 2025.01.06 22:16:55.588 Edge EA (EURUSD.PRO,M1) 2016.04.25 01:50:00: 12153 -10800 diff=-3600 2025.01.06 22:16:55.590 Edge EA (EURUSD.PRO,M1) 2017.01.01 02:00:00: 91725 -7200 OK 2025.01.06 22:16:55.590 Edge EA (EURUSD.PRO,M1) 2017.05.07 05:00:00: 57967 -10800 diff=-3600 2025.01.06 22:16:55.591 Edge EA (EURUSD.PRO,M1) 2017.11.12 23:00:00: 91925 -7200 OK 2025.01.06 22:16:55.592 Edge EA (EURUSD.PRO,M1) 2018.03.19 01:50:00: 22855 -10800 diff=-3600 2025.01.06 22:16:55.593 Edge EA (EURUSD.PRO,M1) 2018.12.09 03:30:00: 59322 -7200 OK 2025.01.06 22:16:55.594 Edge EA (EURUSD.PRO,M1) 2019.05.06 02:30:00: 96423 -10800 diff=-3600 2025.01.06 22:16:55.596 Edge EA (EURUSD.PRO,M1) 2019.12.01 02:00:00: 111551 -7200 OK 2025.01.06 22:16:55.596 Edge EA (EURUSD.PRO,M1) 2020.04.27 03:30:00: 120361 -10800 diff=-3600 2025.01.06 22:16:55.598 Edge EA (EURUSD.PRO,M1) 2020.11.22 23:45:00: 134124 -7200 OK 2025.01.06 22:16:55.599 Edge EA (EURUSD.PRO,M1) 2021.04.19 00:30:00: 148783 -10800 diff=-3600 2025.01.06 22:16:55.600 Edge EA (EURUSD.PRO,M1) 2021.11.14 12:45:00: 215452 -7200 OK 2025.01.06 22:16:55.601 Edge EA (EURUSD.PRO,M1) 2022.04.04 01:50:00: 153015 -10800 diff=-3600 2025.01.06 22:16:55.602 Edge EA (EURUSD.PRO,M1) 2022.11.07 04:00:00: 165962 -7200 OK 2025.01.06 22:16:55.602 Edge EA (EURUSD.PRO,M1) 2023.03.12 23:30:00: 182049 -10800 diff=-3600 2025.01.06 22:16:55.604 Edge EA (EURUSD.PRO,M1) 2023.11.06 01:50:00: 169270 -7200 OK 2025.01.06 22:16:55.604 Edge EA (EURUSD.PRO,M1) 2024.03.11 01:50:00: 181258 -10800 diff=-3600 2025.01.06 22:16:55.606 Edge EA (EURUSD.PRO,M1) 2024.11.04 02:30:00: 208469 -7200 OK 2025.01.06 22:16:55.607 Edge EA (EURUSD.PRO,M1) Binding calendar tables...
Another hint:? relevant?
TimeServerGMTOffset() is -7200 while live but it is 0 when in stress tester.
i tested 3 news events in tester (all is fine while "live"):HI, i've a problem with adjustTZonHistory or with my code ;-) I tried to save the cache file with adjustTZonHistory and without adjustTZonHistory - but the news events are always wrong in the tester. Shifted by 1 hour or by 2 hours.
The code i used:
Output is:
Another hint:? relevant?
TimeServerGMTOffset() is -7200 while live but it is 0 when in stress tester.
i tested 3 news events in tester (all is fine while "live"):Try other symbols (if you have other EURUSD or XAUUSD), use H1 timeframe, make sure you did not apply the adjustment twice. Try to set #define PRINT_DST_DETAILS before includes and look at the detailed logs.
Can you confirm that my indicator is also showing wrong times?
TimeServerGMTOffset() is only for online! In the tester use TimeServerGMTOffsetHistory.
Dear Stanislav - thanks for your help and comment. This is already EURUSD. The adjustment is only done once - it's only called in def init(). Regarding your indicator (you mean CalendarMonitorCachedTZ.mq5) - do i need to look at it in backtesting? Does this work for an indicator?
This is only about Tick data Duckascopy vs. Broker Ticks - as this seems also to be a problem.
I also detected that my imported Duckascopy Tick Data matches sometimes my broker tick data and sometimes not. Most probably due to timezone switching. How can i have to match the news my imported tick data? And how to verify - seems pretty complicated...
Thanks again!
It seems that even live cal data of this summer does not match my brokers tick data as they're out of "line"... this is so ugly. Using the cache file - matches my broker data / chart again. But how to solve this for external data like dukascopy?
OK got it working. I needed to convert my duckascopy data to USD+7 DST US broker times. After that everything matched. Thanks for all your hard work and library.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Economic Calendar Monitor and Cache for Backtesting on History:
This indicator displays current events on the chart and allows you to export the calendar to archives for backtesting, automatically fixing time discrepancies between the history of bars and the history of events. This is an improved version of CalendarMonitorCached indicator from the algotrading book.
Author: Stanislav Korotky