- www.mql5.com
Thank you, Rashid, but even if I update the change_id to the current one and size the value-array to 9999999...
MqlCalendarValue value[9999999]; ulong changeID=33212160; int OnInit() { CalendarValueLastByEvent(840040003,changeID,value); ArrayPrint(value); return(INIT_SUCCEEDED); }
...only 0-values for datetime 1970 01 01 are returned:
Can you please adapt my above code so that actual values are returned?
Thank you very much!
Thank you, Rashid, but even if I update the change_id to the current one and size the value-array to 9999999...
...only 0-values for datetime 1970 01 01 are returned:
Can you please adapt my above code so that actual values are returned?
It seems that we found out the issue resposible for such behaviour. Wait for next beta build please.
Sorry for inconvenience
It seems that we found out the issue resposible for such behaviour. Wait for next beta build please.
Sorry for inconvenience
Ok, thank you for your response and a timely fix in advance!
By the way, MetaQuotes would have had the chance to fix this bug in private because I reported it via the official contact form, but they turned me down because they no longer accept user requests/proposals, which is kind of sad for the users and obviously for MetaQuotes, too. Otherwise it's a great platform and I don't understand why they hide from their (end) customers behind high walls. They should be proud and open to praise as well as to feedback, would make for a first-class reputation and product!
Ok, thank you for your response and a timely fix in advance!
By the way, MetaQuotes would have had the chance to fix this bug in private because I reported it via the official contact form, but they turned me down because they no longer accept user requests/proposals, which is kind of sad for the users and obviously for MetaQuotes, too. Otherwise it's a great platform and I don't understand why they hide from their (end) customers behind high walls. They should be proud and open to praise as well as to feedback, would make for a first-class reputation and product!
For information -
Forum on trade, automatic trading systems and testing of trading strategies
The "Service Desk" section disappeared
MetaQuotes Software Corp. , 2018.08.09 12:43
Servicedesk is going to work now with financial issues only.Forum on trading, automatic trading systems and testing of trading strategies
The "Service Desk" section disappeared
MetaQuotes Software Corp. , 2018.08.09 12:56
Technical questions are now only through the forum.
The effect of the scale of user questions on all occasions hinders the work of our company. We turn to full automation MQL5.community
Forum on trading, automatic trading systems and testing of trading strategies
The "Service Desk" section disappeared
MetaQuotes Software Corp. , 2018.08.09 15:28
Create separate threads with a full description, please. Do not add everything to one topic.
First of all involve other forum participants to analyze the situation.
Try to describe the problem as fully as possible, attach logs, screenshots, sample code, and so on. The main thing is that there was no game of ping-pong, when only a 5-10 step of questions / answers is collected enough material to analyze the situation and play.
Any technical problem should have an answer to the question "can I reproduce". If there is no answer, then the probability of failure of the request is high.
Unfortunately, we can no longer engage in a massive and constantly growing volume of poorly qualified inquiries and frankly educational issues.
Our employees are not teachers in trading or programming.
Ok, thank you for your response and a timely fix in advance!
By the way, MetaQuotes would have had the chance to fix this bug in private because I reported it via the official contact form,
May it is not that bug that coonects with your code. Run this sample of Economic calendar events listenter. Sorry for Russian comments - didn't have time for translation
//+------------------------------------------------------------------+ //| Demo_CalendarValueLast.mq5 | //| Copyright 2018, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2018, MetaQuotes Software Corp." #property link "https://www.mql5.com" #property version "1.00" #property description "Пример использования функции CalendarValueLast" #property description " для отлавливания выхода отчета по событию Nonfarm Payrolls." #property description "Для этого необходимо получить текущий идентификатор изменения" #property description " базы Календаря. И затем по этому идентификатору получать" #property description " только новые события для через опрос в таймере" //+------------------------------------------------------------------+ //| Expert initialization function | //+------------------------------------------------------------------+ int OnInit() { //--- create timer EventSetTimer(60); //--- return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Expert deinitialization function | //+------------------------------------------------------------------+ void OnDeinit(const int reason) { //--- destroy timer EventKillTimer(); } //+------------------------------------------------------------------+ //| Expert tick function | //+------------------------------------------------------------------+ void OnTick() { //--- } //+------------------------------------------------------------------+ //| Timer function | //+------------------------------------------------------------------+ void OnTimer() { //--- идентификатор изменения базы Календаря static ulong calendar_change_id=0; //--- признак первого запуска static bool first=true; //--- массив значений событий MqlCalendarValue values[]; //--- проведем инициализацию - получим текущий calendar_change_id if(first) { //--- получим идентификатор изменения базы Календаря if(CalendarValueLast(calendar_change_id,values)>0) { //--- этот блок кода не может выполниться при первом запуске, но мы его все равно пропишем PrintFormat("%s: Получен текущий идентификатор базы Календаря: change_id=%d", __FUNCTION__,calendar_change_id); //--- выставим флаг и выйдем до следущего события таймера first=false; return; } else { //--- данные не получены (для первого запуска это нормально), проверим наличие ошибки int error_code=GetLastError(); if(error_code==0) { PrintFormat("%s: Получен текущий идентификатор базы Календаря: change_id=%d", __FUNCTION__,calendar_change_id); //--- выставим флаг и выйдем до следущего события таймера first=false; //--- теперь у нас есть значение calendar_change_id return; } else { //--- а вот это действительно ошибка PrintFormat("%s: Не удалось получить события в CalendarValueLast. Код ошибки: %d", __FUNCTION__,error_code); //--- неудачное завершение работы, попробуем заново при следующем вызове таймера return; } } } //--- у нас есть последнее известное значение идентификатора изменения Календаря (change_id) ulong old_change_id=calendar_change_id; //--- проверим - не появилось ли новое значение события "Nonfarm Payrolls" if(CalendarValueLast(calendar_change_id,values)>0) { PrintFormat("%s: Получены новые события для Календаря: %d", __FUNCTION__,ArraySize(values)); //--- выведем в Журнал информацию из массива values ArrayPrint(values); //--- выведем в Журнал значения предыдущего и нового идентификатора Календаря PrintFormat("%s: Предыдущий change_id=%d, новый change_id=%d", __FUNCTION__,old_change_id,calendar_change_id); //--- выведем в Журнал новые события ArrayPrint(values); /* пропишите здесь свой код, который будет обрабатывать появление событий */ } //--- } /* Пример работы слушателя: OnTimer: Получен текущий идентификатор базы Календаря: change_id=33281792 OnTimer: Получены новые события для Календаря: 1 [id] [event_id] [time] [period] [revision] [actual_value] [prev_value] [revised_prev_value] [forecast_value] [impact_type] [reserved] [0] 91040 76020013 2019.03.20 15:30:00 1970.01.01 00:00:00 0 -5077000 -1913000 -9223372036854775808 -4077000 2 0 OnTimer: Предыдущий change_id=33281792, новый change_id=33282048 [id] [event_id] [time] [period] [revision] [actual_value] [prev_value] [revised_prev_value] [forecast_value] [impact_type] [reserved] [0] 91040 76020013 2019.03.20 15:30:00 1970.01.01 00:00:00 0 -5077000 -1913000 -9223372036854775808 -4077000 2 0 OnTimer: Получены новые события для Календаря: 1 [id] [event_id] [time] [period] [revision] [actual_value] [prev_value] [revised_prev_value] [forecast_value] [impact_type] [reserved] [0] 91041 76020013 2019.03.27 15:30:00 1970.01.01 00:00:00 0 -9223372036854775808 -5077000 -9223372036854775808 -7292000 0 0 OnTimer: Предыдущий change_id=33282048, новый change_id=33282560 [id] [event_id] [time] [period] [revision] [actual_value] [prev_value] [revised_prev_value] [forecast_value] [impact_type] [reserved] [0] 91041 76020013 2019.03.27 15:30:00 1970.01.01 00:00:00 0 -9223372036854775808 -5077000 -9223372036854775808 -7292000 0 0 */ //+------------------------------------------------------------------+
- www.mql5.com
Hi Rashid,
many thanks, great work! However, I noticed that many calendar values are delivered with (partially huge) delay, e.g. the last ISM United States Manufacturing Purchasing Managers Index (PMI) as of 1st July 2019 was delivered with nearly 2 minutes (!) delay — please compare the planned and actual times in the below screenshots. Had I traded the signal at that time I would have incurred heavy losses during the following market counter-reaction, so basically the Economic calendar functions are currrently in large part useless or even dangerous unfortunately. What is MetaQuotes doing to speed up their calendar signals, please?
Many thanks in advance!
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello,
has anybody got the new MQL5 calendar functions (see https://www.metatrader5.com/en/releasenotes) to work?
MqlCalendarValue value[];
ulong changeID;
CalendarValueLastByEvent(840040003,changeID,value);
ArrayPrint(value);
...does work but it only returns 0-values for datetime 1970 01 01.
Any solutions?
Thanks!