Windows yerel saatinin MT5 sunucusuyla senkronizasyonu - sayfa 3

 
fxsaber :
Ping ikiye bölünmelidir - ileri geri değil, sadece geri ihtiyacınız var.

Ya burada sadece MQ sayılırsa?

Katma

düzeltildi

Katma

Danışmanın daha güvenli çalışması için

Piyasa İzleme'de mevcut yüksek likiditeyi eklemek gerekir

RTS, Si, BR gibi gelecekler

Dosyalar:
 

Akşam takasına da senkronizasyon eklememiz gerekiyor.

Katma

Yapılmış ve açıklıklarda

Dosyalar:
 

Temizlemede bir düzeltme oldu (gerçek)

2017.01 . 18 18 : 56 : 11.852 Time_sync_forts (URKA- 3.17 ,H1)  Local time sync is done.


Ama sonuç hiç de hoş olmadı.

49 saniyelik bir gecikme oldu :(

Yarın markete bakacağım....

 
Mikalas, sen benim idolümsün! :-)
 
Dennis Kirichenko :
Mikalas, sen benim idolümsün! :-)
Amca dayı! Neye ihtiyacın var?
 

"Köpek gömülü" budur

Print ( "Local time sync is done. Symbol = " , symbol, " Sync min = " , loc_time.wMinute,
                           " Sync sec = " , loc_time.wSecond, " Sync mcs = " , loc_time.wMilliseconds);

2017.01 . 18 20 : 05 : 01.743 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = RTS- 3.17 Sync min = 5 Sync sec = 1 Sync mcs = 428
2017.01 . 18 20 : 05 : 01.869 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = Si- 3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01 . 18 20 : 05 : 01.890 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = BR- 2.17 Sync min = 5 Sync sec = 2 Sync mcs = 61
2017.01 . 18 20 : 05 : 01.918 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = BR- 2.17 Sync min = 5 Sync sec = 2 Sync mcs = 61
2017.01 . 18 20 : 05 : 01.942 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = RTS- 3.17 Sync min = 5 Sync sec = 1 Sync mcs = 428
2017.01 . 18 20 : 05 : 01.942 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = Si- 3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01 . 18 20 : 05 : 01.983 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = RTS- 3.17 Sync min = 5 Sync sec = 2 Sync mcs = 156
2017.01 . 18 20 : 05 : 02.055 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = BR- 2.17 Sync min = 5 Sync sec = 2 Sync mcs = 61
2017.01 . 18 20 : 05 : 02.081 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = RTS- 3.17 Sync min = 5 Sync sec = 2 Sync mcs = 156
2017.01 . 18 20 : 05 : 02.081 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = Si- 3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01 . 18 20 : 05 : 02.121 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = RTS- 3.17 Sync min = 5 Sync sec = 2 Sync mcs = 156
2017.01 . 18 20 : 05 : 02.216 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = BR- 2.17 Sync min = 5 Sync sec = 2 Sync mcs = 385
2017.01 . 18 20 : 05 : 02.242 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = BR- 2.17 Sync min = 5 Sync sec = 2 Sync mcs = 385
2017.01 . 18 20 : 05 : 02.255 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = RTS- 3.17 Sync min = 5 Sync sec = 2 Sync mcs = 156
2017.01 . 18 20 : 05 : 02.255 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = Si- 3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01 . 18 20 : 05 : 02.314 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = Si- 3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01 . 18 20 : 05 : 02.405 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = Si- 3.17 Sync min = 5 Sync sec = 1 Sync mcs = 475
2017.01 . 18 20 : 05 : 02.432 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = RTS- 3.17 Sync min = 5 Sync sec = 2 Sync mcs = 156
2017.01 . 18 20 : 05 : 02.432 Time_sync_forts (RTS- 3.17 ,M1)   Local time sync is done. Symbol = Si- 3.17 Sync min = 5 Sync sec = 2 Sync mcs = 614
 

Önceki koltuk değneği çok daha zarifti (tasarım gereği), ancak,

bunu dene

//+------------------------------------------------------------------+
//|                                              Time_sync_forts.mq5 |
//|                                      Copyright 2017 prostotrader |
//|                                             https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2017 prostotrader"
#property link        "https://www.mql5.com"
#property version    "1.00"
//---
struct _SYSTEMTIME
  {
   ushort             wYear;
   ushort             wMonth;
   ushort             wDayOfWeek;
   ushort             wDay;
   ushort             wHour;
   ushort             wMinute;
   ushort             wSecond;
   ushort             wMilliseconds;
  };

_SYSTEMTIME loc_time;

#import "kernel32.dll"
void GetLocalTime(_SYSTEMTIME &sys_time);
bool SetLocalTime(_SYSTEMTIME &sys_time);
#import
//---
bool      is_sync;
string    symb_rts;
string    symb_si;
string    symb_gold;
string    symb_br;
string    symb_gazr;
string    symb_sbrf;
datetime last_time;
//
input string BrInstr= "BR-2.17" ; //Brent
//+------------------------------------------------------------------+
//| Expert set second symbol function                                |
//+------------------------------------------------------------------+
string SetSecSymbol( const string a_symbol, const string prefix)
  {
   int str_tire= 0 ;
   ushort let_symbol;
   int str_size= StringLen (a_symbol);

   for ( int i= 0 ; i<str_size; i++)
     {
      let_symbol= StringGetCharacter (a_symbol,i);

       if (let_symbol== '-' )
        {
         str_tire=i;
         break ;
        }
     }
   if (str_tire> 0 )
     {
       return (prefix + StringSubstr (a_symbol, str_tire, str_size - str_tire));
     }
   return ( "" );
  }
//+------------------------------------------------------------------+
//| Expert initialization function                                   |
//+------------------------------------------------------------------+
int OnInit ()
  {
   last_time= TimeCurrent ();
   is_sync= false ;
   MarketBookAdd ( Symbol ());
//---  
   symb_rts=SetSecSymbol( Symbol (), "RTS" );
   if (! SymbolSelect (symb_rts, true ))
     {
       MessageBox (symb_rts+ " not found in the Market watch!" , "Error" , MB_OK | MB_ICONERROR );
       return ( INIT_FAILED );
     }
   else MarketBookAdd (symb_rts);
//---  
   symb_si=SetSecSymbol( Symbol (), "Si" );
   if (! SymbolSelect (symb_si, true ))
     {
       MessageBox (symb_si+ " not found in the Market watch!" , "Error" , MB_OK | MB_ICONERROR );
       return ( INIT_FAILED );
     }
   else MarketBookAdd (symb_si);
//---
   symb_gold=SetSecSymbol( Symbol (), "GOLD" );
   if (! SymbolSelect (symb_gold, true ))
     {
       MessageBox (symb_gold+ " not found in the Market watch!" , "Error" , MB_OK | MB_ICONERROR );
       return ( INIT_FAILED );
     }
   else MarketBookAdd (symb_gold);
//---
   symb_gazr=SetSecSymbol( Symbol (), "GAZR" );
   if (! SymbolSelect (symb_gazr, true ))
     {
       MessageBox (symb_gazr+ " not found in the Market watch!" , "Error" , MB_OK | MB_ICONERROR );
       return ( INIT_FAILED );
     }
   else MarketBookAdd (symb_gazr);
//---
   symb_sbrf=SetSecSymbol( Symbol (), "SBRF" );
   if (! SymbolSelect (symb_sbrf, true ))
     {
       MessageBox (symb_sbrf+ " not found in the Market watch!" , "Error" , MB_OK | MB_ICONERROR );
       return ( INIT_FAILED );
     }
   else MarketBookAdd (symb_sbrf);
//---
   symb_br=BrInstr;
   if (! SymbolSelect (symb_br, true ))
     {
       MessageBox (symb_br+ " not found in the Market watch!" , "Error" , MB_OK | MB_ICONERROR );
       return ( INIT_FAILED );
     }
   else MarketBookAdd (symb_br);
   return ( INIT_SUCCEEDED );
  }
//+------------------------------------------------------------------+
//| Expert deinitialization function                                 |
//+------------------------------------------------------------------+
void OnDeinit ( const int reason)
  {
   MarketBookRelease ( Symbol ());
   MarketBookRelease (symb_rts);
   MarketBookRelease (symb_br);
   MarketBookRelease (symb_si);
   MarketBookRelease (symb_gold);
   MarketBookRelease (symb_gazr);
   MarketBookRelease (symb_sbrf);
  }
//+------------------------------------------------------------------+
//| Expert On book event function                                    |
//+------------------------------------------------------------------+
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 )) ||
         ((loc_time.wHour== 14 ) && (loc_time.wMinute>= 0 ) && (loc_time.wMinute<= 4 )) ||
         ((loc_time.wHour== 18 ) && (loc_time.wMinute>= 45 ) && (loc_time.wMinute<= 59 )))
        {
         MqlDateTime sv_time;
         datetime cur_time= TimeCurrent (sv_time);
         if ( ulong (cur_time) == ulong (last_time)) return ;
         if ((loc_time.wDayOfWeek== ushort (sv_time.day_of_week)) &&
            (loc_time.wHour== ushort (sv_time.hour)))
           {
              
               if (!is_sync)
                 {
                  loc_time.wMinute = ushort (sv_time.min);
                  loc_time.wSecond = ushort (sv_time.sec);
                  loc_time.wMilliseconds= 0 ;
                   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);
                    }
                 }
              
           }
        }
       else
        {
         is_sync= false ;
         last_time= TimeCurrent ();
        }
     }
  }
//+------------------------------------------------------------------+
 
prostotrader :

Önceki koltuk değneği çok daha zarifti (tasarım gereği), ancak,

bunu dene

OnBookEvent ile hiçbir şey çalışmayacak, OnTick'te senkronize etmeniz gerekiyor.

kene zamanını kullandığınız ortaya çıkıyor ve sipariş defteri değişikliği sırasında verileri alıyorsunuz,

saat OnBookEvent != OnTick

 
Sergey Chalyshev :

OnBookEvent ile hiçbir şey çalışmayacak, OnTick'te senkronize etmeniz gerekiyor.

kene zamanını kullandığınız ortaya çıkıyor ve sipariş defteri değişikliği sırasında verileri alıyorsunuz,

saat OnBookEvent != OnTick

Hayır, Seryozha!

Seçilen sembol üzerinde OnTick gelmeyebilir, ancak OnBookEvent() herhangi bir değişiklikte tetiklenir

seçilen tüm enstrümanların bardakları.

 
prostotrader :

Hayır, Seryozha!

Seçilen sembol üzerinde OnTick gelmeyebilir, ancak OnBookEvent() herhangi bir değişiklikte tetiklenir

seçilen tüm enstrümanların bardakları.

OnBookEvent() patlayacak, ancak sipariş defteri değişikliğinin zamanı hiçbir yerde sabitlenmedi.

Sadece kene varış zamanı sabittir, yani. teklifi değiştir, son, sor.

Camın değiştiği ortaya çıkıyor ve eski zamanı, son kene varış zamanını alıyorsunuz.