Market closed - page 6

 
fxsaber:

see that the timing will only be different in these situations


It has been discussed several times that MqlTick does not return the tick as is. That there are two tick streams - quote and deal. And that in CopyTicks they are merged sometimes retroactively, because the streams are unsynchronized. And that the timing of MqlTick and CopyTicks may not coincide.


Is it really possible for 10 SEK. not to coincide?

2017.09.22 11:18:38.257 Test_time (RTS-12.17,M1)        CopyTicks time = 11:18:27; SymbolInfoTick = 11:18:37
 
prostotrader:

Can 10 SEC. not match?

There is no such thing on Metaquotes-Demo.

 
fxsaber:

No such thing on Metaquotes-Demo.


It's a demo opener, I'll try it on the real thing...

Added

Yeah, it's more fun when it's not real.

2017.09.22 11:58:03.892 Test_time (Si-12.17,M1) CopyTicks time = 11:58:03; SymbolInfoTick = 11:58:03
2017.09.22 11:58:03.922 Test_time (Si-12.17,M1) CopyTicks time = 11:58:03; SymbolInfoTick = 11:58:03
2017.09.22 11:58:05.186 Test_time (Si-12.17,M1) CopyTicks time = 11:58:03; SymbolInfoTick = 11:58:04
2017.09.22 11:58:06.110 Test_time (Si-12.17,M1) CopyTicks time = 11:58:03; SymbolInfoTick = 11:58:05
2017.09.22 11:58:06.230 Test_time (Si-12.17,M1) CopyTicks time = 11:58:06; SymbolInfoTick = 11:58:06
2017.09.22 11:58:06.350 Test_time (Si-12.17,M1) CopyTicks time = 11:58:06; SymbolInfoTick = 11:58:06
2017.09.22 11:58:06.430 Test_time (Si-12.17,M1) CopyTicks time = 11:58:06; SymbolInfoTick = 11:58:06
2017.09.22 11:58:06.430 Test_time (Si-12.17,M1) CopyTicks time = 11:58:06; SymbolInfoTick = 11:58:06
2017.09.22 11:58:07.174 Test_time (Si-12.17,M1) CopyTicks time = 11:58:07; SymbolInfoTick = 11:58:07
 
prostotrader:

not in real life is funnier.

Milliseconds and other data are there.

 

For now, I have decided to do the following

//bool CheckMarketTime(const string a_symbol)
bool CheckMarketTime()
{
  sv_time.year = 0;
  TimeTradeServer(sv_time);
  if(sv_time.year > 0)
  {
    if((sv_time.day_of_week == int(FirstDay)) ||                 //первый выходной
       (sv_time.day_of_week == int(SecondDay))) return(false);   //Второй выходной
    sv_time.year = 0;   
    TimeCurrent(sv_time);
    if(sv_time.year > 0)
    {   
      ulong cur_time = sv_time.hour * 3600 + sv_time.min * 60 + sv_time.sec;
      if(((cur_time >= time_st_mon) && (cur_time < 50370)) ||
         ((cur_time >= time_st_day) && (cur_time < 67470)) ||
         ((cur_time >= time_st_evn) && (cur_time < 85770)))
      {
        return(true);
      }
    }
  }
}
 

The good idea is to simply translate the server (exchange) time

instead of TimeCurrent(), which is taken from the last known quote in Market Watch,

make a function TimeServer(), which simply translates the time of the exchange.

Then the TimeTradeServer() will not be needed.

The two functions will be enough

TimeLocal() and TimeServer()

 
prostotrader:

For now, decided to make it this way

Reminded of TC's behaviour in this thread.

Перевод string в часы и минуты
Перевод string в часы и минуты
  • 2017.09.06
  • www.mql5.com
Когда встаёт задача задать во входных параметрах время в формате ЧЧ:ММ, приходится решать дилему: удобство пользователя при вводе значений или удоб...
 

In the picture the output on the graph is TimeTradeServer() function, time runs faster.
If you output TimeCurrent(), it will be the time of the latest quote by the current symbol and therefore also often inconsistency.
How can I get the latest time of the most recent quote from Market Watch to output the time synchronously with the time in Market Watch?



 
Vasiliy Pushkaryov:

How can I get the latest time of the most recent quote from Market Watch to output the time synchronously with the time in Market Watch?

TimeCurrent.

 
fxsaber:

TimeCurrent.

Yeah, it's not very good either. I use OnTimer to output once per second, I decided to add the message output to the print as well. I can see that the same time passes there twice. Now I only saw in help that TimeCurrent for OnTimer is " time of last quote for any symbol available in Market Watch window, the same time which is shown in header of this window".

I.e. this is what is needed. In theory. But in practice, something is not quite right.



Reason: