Synchronise Windows local time with the MT5 server - page 5

 
prostotrader:

No, it's not!

Anything OTHER than MT5 server time is NOT RIGHT, as we trade through the MT5 SERVER!!!!

Added

I would VERY much hope that the MT5 server time itself is SYNCHRONIZED correctly with the time of the Bourse!

The first two pages of http://forum.moex.com/viewtopic.asp?t=15432&topicdays=0&postorder=asc&start=0 have a lot of interesting information about FORTS exchange time synchronization, and the address of ntp.rtsnet.ru NTP server of RTS exchange, which all brokers can use to synchronize their time, is also listed. It was not available to clients. True, this is 2009-2010. Your broker's technical support will probably answer how the broker in question is now.

Apart from the synchronization itself, I would also like to see a "smooth" time shift algorithm applied, so that subsequent events do not get the previous time from the broker. This mechanism is not included in NTP synchronization.

Точность часов ФОРТС — Форум «Техническая поддержка» Московской Биржи
Точность часов ФОРТС — Форум «Техническая поддержка» Московской Биржи
  • forum.moex.com
Пожалуйста, проясните, с какой точностью идут часы, используемые системой ФОРТС для временной разметки сделок. Меня интересует, синхронизируются ли часы с какими либо высокоточными часами реального времени (GPS, атомными часами или т.п.), как часто происходит синхронизация, какова погрешность времени на ФОРТС между периодами синхронизации...
 
Vladimir:

The first two pages of http://forum.moex.com/viewtopic.asp?t=15432&topicdays=0&postorder=asc&start=0 contain a lot of interesting information about time synchronisation on the FORTS exchange, as well as the address of ntp.rtsnet.ru NTP server of the RTS exchange, through which all brokers can synchronise their time. It was not available to clients. True, this is 2009-2010. The technical support of your broker, probably, will answer, as now at the given broker.

Apart from the synchronization itself, I would also like to see a "smooth" time shift algorithm applied, so that subsequent events do not get the previous time from the broker. This mechanism is not included in NTP synchronization.

Здравствуйте, уточню, вы через ВПН подключаетесь к срочному рынку ? Т.к. через интернет сервисы синхронизации времени не доступны.

С уважением,
Глеб Кочнев
Техническая поддержка ПАО Московская Биржа
+7 (495) 733-95-07 | help@moex.com
 

Can someone explain why this code does not accurately synchronise time?

After all, the premarket receives a "fresh" quotation, with the new server(exchange) time.

void OnBookEvent(const string &symbol)
  {
   loc_time.wYear=0;
   GetLocalTime(loc_time);
   if(loc_time.wYear>0)
     {
      if((loc_time.wHour==9) && (loc_time.wMinute>=50) && (loc_time.wMinute<=59))
        {
         MqlTick curr_tick[1];
         if(CopyTicks(symbol,curr_tick,COPY_TICKS_INFO,0,1)==1)
           {
            MqlDateTime sv_time;
            TimeToStruct(curr_tick[0].time,sv_time);
            if(!is_sync)
              {
               if((loc_time.wDayOfWeek==ushort(sv_time.day_of_week)) &&
                  (loc_time.wHour==ushort(sv_time.hour)))
                 {
                  long last_ping=long(NormalizeDouble((double(TerminalInfoInteger(TERMINAL_PING_LAST))/1000)/2,0));
                  long mls_time=long(curr_tick[0].time_msc%1000);
                  if((mls_time+last_ping)>999)
                    {
                     mls_time=long(curr_tick[0].time_msc)+last_ping;
                     if(!ConvertToTime(mls_time, loc_time)) return;
                    }
                  else
                    {
                     loc_time.wMinute = ushort(sv_time.min);
                     loc_time.wSecond = ushort(sv_time.sec);
                     loc_time.wMilliseconds=ushort(mls_time);
                    }
                  if(SetLocalTime(loc_time))
                    {
                     is_sync=true;
                     Print("Local time sync is done. Symbol = ", symbol, " Sync min = ", loc_time.wMinute,
                           " Sync sec = ", loc_time.wSecond, " Sync ms = ", loc_time.wMilliseconds);
                    }
                 }
              }
           }
        }
      else is_sync=false;
     }
  }
 

Let me explain what the above code was based on.

The CopyTicks() function with flagCOPY_TICKS_INFO

flag returns the last quote (Bid, Ask) with server time, and since the BID and/or ASK changes will cause

OnBookEvent() event, we can get the time of the last quote.

Checking

if((loc_time.wDayOfWeek==ushort(sv_time.day_of_week)) &&
                  (loc_time.wHour==ushort(sv_time.hour)))


we make sure that it is a "fresh" quote.

Why, after 10:00 server time does not coincide by a few seconds

with the synchronized local time?

 
prostotrader:
Здравствуйте, уточню, вы через ВПН подключаетесь к срочному рынку ? Т.к. через интернет сервисы синхронизации времени не доступны.

С уважением,
Глеб Кочнев
Техническая поддержка ПАО Московская Биржа
+7 (495) 733-95-07 | help@moex.com

And how is your key question resolved: "One would VERY much hope that the MT5 server time itself is SYNCHRONIZED correctly with the time of the Bourse!"?

 
Vladimir:

And how was your key question resolved: "I VERY much hope that the MT5 server time itself is SYNCHRONIZED correctly with the exchange time!

No resolution, how do I know how the developers synchronise the MT5 server time with the exchange time?

The broker (Otkoytiye) wrote that automatically, but how exactly, only the developers know,

but they are not involved in the discussion.

Added

And this is not my key question!

My question is:

How can I synchronize my local time with the time of MT5 FORTS server as accurately as possible?

 
prostotrader:

How can I synchronise my local time as accurately as possible with the time of the MT5 FORTS server?

OnTick.
 
fxsaber:
OnTick.

OnTick does not come in pre-market and in clearing, and the time

needs to be synchronised BEFORE bidding!

 
prostotrader:

OnTick does not come in pre-market and in clearing, and the time

needs to be synchronised BEFORE bidding!

I see no reason to synchronise the time BEFORE trading. Opened the terminal at 11:32 and it synced on the first tick.
 
fxsaber:
I don't see any reason to synchronise time BEFORE trading. Opened the terminal at 11:32 and it synced on the first tick.
2017.01.13 10:00:03.969 Trades  'xxxxx': buy limit 2.00 ED-6.17 at 1.0642
2017.01.13 10:00:03.969 Trades  'xxxxx': sell limit 1.00 ED-6.17 at 1.0813
2017.01.13 10:00:03.975 Trades  'xxxxx': accepted buy limit 2.00 ED-6.17 at 1.0642
2017.01.13 10:00:03.975 Trades  'xxxxx': accepted sell limit 1.00 ED-6.17 at 1.0813
2017.01.13 10:00:03.978 Trades  'xxxxx': failed buy limit 2.00 ED-6.17 at 1.0642 [Market closed]
2017.01.13 10:00:03.979 Trades  'xxxxx': failed sell limit 1.00 ED-6.17 at 1.0813 [Market closed]

Broker's reply

Со своей стороны видим, что заяви ниже подавались в другое время

2017.01.13 09:59:58.098               * request transfered to dealers * (buy limit 2.00 ED-6.17 at 1.0642)

2017.01.13 09:59:58.099               * request transfered to dealers * (sell limit 1.00 ED-6.17 at 1.0813)

2017.01.13 09:59:58.099               * request from '*' (buy limit 2.00 ED-6.17 at 1.0642)

2017.01.13 09:59:58.099               * request from '*' (sell limit 1.00 ED-6.17 at 1.0813)

2017.01.13 09:59:58.100               * reject (Market closed) for '*' (buy limit 2.00 ED-6.17 at 1.0642)(1.0641 / 1.0814 / 1.0695)

2017.01.13 09:59:58.100               * reject (Market closed) for '*' (sell limit 1.00 ED-6.17 at 1.0813)(1.0641 / 1.0814 / 1.0695)

And I'm seeing it.

Added

And I have the terminal running for 90 days all the time (before the futures change)

Added

My robots don't require my participation, sometimes I don't go near

I don't go to my computer for a week. If something extreme happens I get a text message.