prostotrader
10733

You guys are the developers!

When are you going to synchronise the terminal time with the Exchange time?

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]
prostotrader
10733
prostotrader  
2017.01.13 10:00:03.210 Trades  'xxxxx': buy limit 1.00 MXI-6.17 at 2230.15
2017.01.13 10:00:03.210 Trades  'xxxxx': sell limit 1.00 MXI-6.17 at 2300.75
2017.01.13 10:00:03.216 Trades  'xxxxx': accepted buy limit 1.00 MXI-6.17 at 2230.15
2017.01.13 10:00:03.218 Trades  'xxxxx': accepted sell limit 1.00 MXI-6.17 at 2300.75
2017.01.13 10:00:03.219 Trades  'xxxxx': failed buy limit 1.00 MXI-6.17 at 2230.15 [Market closed]
2017.01.13 10:00:03.220 Trades  'xxxxx': failed sell limit 1.00 MXI-6.17 at 2300.75 [Market closed]

added

The trading time is checked before the order is sent

//+------------------------------------------------------------------+
//| Expert Check traiding time function                              |
//+------------------------------------------------------------------+
bool CheckTradingTime(MqlDateTime &tick_time)
{
  datetime lk_time = TimeCurrent(tick_time);
  if ( ( tick_time.day_of_week == int(FirstDay)) ||
       ( tick_time.day_of_week == int(SecondDay)))//выходные
  {
    return(false);
  }
#ifdef DEBUG
  if ((tick_time.hour >= 0) && (tick_time.hour < 6))   // DEBUG 6-00
  {
    return(false);
  }
#else
  
if ((tick_time.hour >= 0) && (tick_time.hour < 10))
  {
    return(false);
  }
#endif
// 13 * 3600 + 59 * 60 + 30 = 50370 - 13:59:30
// 14 * 3600                = 50400 - 14:00:00
// 14 * 3600 + 30           = 50430 - 14:00:30
// 14 * 3600 + 60           = 50460 - 14:01:00

// 18 * 3600 + 44 * 60 + 30 = 67470 - 18:44:30
// 18 * 3600 + 45 * 60      = 67500 - 18:45:00
// 18 * 3600 + 45 * 60 + 30 = 67530 - 18:45:30
// 18 * 3600 + 46 * 60      = 67560 - 18:46:00

// 19 * 3600                = 68400 - 19:00:00
// 19 * 3600 + 60           = 68460 - 19:01:00  

// 23 * 3600 + 49 * 60 + 30 = 85770 - 23:49:30
// 23 * 3600 + 50 * 60      = 85800 - 23:50:00
// 23 * 3600 + 50 * 60 + 30 = 85830 - 23:50:30
// 23 * 3600 + 51 * 60      = 85860 - 23:51:00
//---
  ulong trade_time = tick_time.hour * 3600 + tick_time.min * 60 + tick_time.sec;  
//---                    //10:00:02                      
  if(((trade_time >= time_st_mon) && (trade_time < 50370)) ||
      ((trade_time >= time_st_day) && (trade_time < 67470)) ||
      ((trade_time >= time_st_evn) && (trade_time < 85770)))
  {
    return(true);
  }

return(false); 


}
input string          TimeStMon    = "10:00:02";         //Время начала утренней сессии

ulong time_st_mon = GetStringTime(TimeStMon);
ulong GetStringTime(const string a_string)
{
  int k = 0;
  string s_sec, s_min, s_hour;
  int str_size = StringLen(a_string);
//---
  if(str_size != 8) return(0);  
//---  
  for(int i = str_size - 1; i >= 0; i--)
  {
    ushort let_symbol = StringGetCharacter(a_string, i);
    
    if(let_symbol == ':')
    {
      k++;
      switch(k)
      {
        case 1:
          s_sec = StringSubstr(a_string, i + 1, str_size - i - 1);
        break;
        case 2:
          s_min = StringSubstr(a_string, i + 1, str_size - i - 4);
          s_hour = StringSubstr(a_string, 0, i);
        break;
      }
//---
    }
  }
  if(k != 2) return(0);
  ulong t_sec = ulong(StringToInteger(s_sec));
  ulong t_min = ulong(StringToInteger(s_min)) * 60;
  ulong t_hour = ulong(StringToInteger(s_hour)) * 3600;
//---    
  return(t_hour + t_min + t_sec);
}
Sergey Chalyshev
8991
prostotrader:

You guys are the developers!

When are you going to synchronise the terminal time with the Exchange time?

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]

It is necessary to understand who spits on the world time and sets its own, the exchange or the broker. With vested interest or just out of stupidity.

Who has the same time as the world time?

prostotrader
10733
prostotrader  
Sergey Chalyshev:

You have to figure out who spits on the world's time and sets their own, the stock exchange or the broker. Whether for self-interest or just out of stupidity.

Who has the same time as the world time?

Yes, forget about the world time, we trade on the Moscow Exchange at the same time,

and it's not the broker's fault, it's the developers', because any quote that comes from the Exchange

has time, therefore the time of the last known quote should be

known time of the exchange (NOT the SERVER) and the TERMINAL

TimeCurrent

Возвращает последнее известное время сервера, время прихода последней котировки по одному из выбранных в "Обзоре рынка" символов.


TimeCurrent, returns the time of the SERVER, not the TERMINAL!

This is probably where the "legs grow from".

Sergey Chalyshev
8991
prostotrader:

Yes, let it be, the world, we are trading on the Moscow Exchange, according to the Exchange's time,

and it's not the broker's fault, it's the developers', because any quote that comes from the Exchange

has time, therefore the time of the last known quote should be

known time of the exchange (NOT THE SERVER) and the TERMINAL

TimeCurrent

Возвращает последнее известное время сервера, время прихода последней котировки по одному из выбранных в "Обзоре рынка" символов.


TimeCurrent, returns the time of the SERVER, not the exchange!

Hence, probably "the legs grow".

And if the server in Moscow, and the exchange is in Brazil, can it be?

prostotrader
10733
prostotrader  
Sergey Chalyshev:

And if the server is in Moscow and the exchange is in Brazil, can this be?

I don't care where the server is!

The quote (or rather quote TIME) is the current TIME.

Added

Right now, what's going on?

MT5 server just sends a quote to the terminal, independent from the time of the quote,

The time of the server and the time of the quote are not synchronized because there is a premarket.

The EA sends the order, the terminal confirms it and the server checks the time against

The server checks the time UNLESS I know what it is and then re-adjusts the order with an error of 3 seconds (my time) !!!!.

Sergey Chalyshev
8991
prostotrader:

I don't care where the server is!

The quote (or rather the TIME of the quote) is the current TRADE time.

Added by

Right now, what's going on is

The MT5 server simply sends a quote to the terminal, irrespective of the time of the quote,

The time of the server and the time of the quote are not synchronized because there is a premarket.

The EA sends the order, the terminal confirms it and the server checks the time against

the server checks the time EVERYWHERE and re-adjusts the order with an error of about 3 seconds!!!!

Quote (or rather quote TIME) is the current TIME.

this is stock time.

The server time is not transferred to the terminal at all: TimeLocal == TimeTradeServer.

Sergey Chalyshev
8991

I, too, am sick of this problem. It's a topic that has come up on the forum a number of times. Everyone solves this problem in their own way, but I haven't seen the right solution. It is necessary to determine how to correct and urge the developers to fix it.

Now there are three functions to get the time (if memory serves right) is:

TimeLocal==TimeTradeServer, computer time,

TimeTradeServer == worthless function,

TimeCurrent == time of last quote.

We need to add the exchange time, throw outTimeTradeServeror pass the current exchange time instead, or add aTimeExchangetype.




Sergey Chalyshev
8991

And the best thing would be to get specific data into the terminal without getting bogged down by time:

- You can put up new applications,

- You can delete orders,

- Trading is allowed.

For some reason there is no such functionality in the terminal right now.

Sergey Chalyshev
8991

Нужно добавить время биржы, выкинуть TimeTradeServer или вместо него передавать текущее время биржи, или добавить типа TimeExchange.

It's still not an option for our exchange, I don't know about others.

They start trading when they want, sometimes at 10:00, sometimes at 10:03 or 10:05.

Apparently, when they wake up and drink coffee, they switch it on)).


prostotrader
10733
prostotrader  

Sergei!

Read the TimeCurrent help - it says that this is the SERVER time

Возвращает последнее известное время сервера, время прихода последней котировки по одному из выбранных в "Обзоре рынка" символов.