A minute and a half difference between local time and fresh tick time. What to do. - page 3

 
pivomoe:

TimeCurrent() - The time of the last tick on a character will be less than the delay time, so it can be used. Using local time in the first version was not a good idea.

Whoa... well, the current version seems to be unsuccessful too.

Let's read the definition of TimeCurrent():

TimeCurrent

Returns last known server time, time of last quote arrival by one of symbols selected in "Market Watch".

One of them means that the time of the most frequent (for simplicity, the most liquid) is displayed. And this is not what you want. What you need is SymbolInfoInteger( blah-blah, SYMBOL_TIME ). It looks like this.

 
Alexey Kozitsyn:

Whoa... dac, the current version seems to be failing too.

Read the definition of TimeCurrent():

By one it means that it displays the time of the most frequently changing (for simplicity, the most liquid). And this is not what you need. What you need is SymbolInfoInteger( blah-blah, SYMBOL_TIME ). I think so.

That's how I tried for prostotrader to carry what I see the problem. In the last version I go through all symbols and take the maximal time of the last received tick.

   for(int i=0; i<KolichestvoSimvolov; i++)     
   if( InformaziaOPoslednemTike[i].LastTick.time_msc > VremaySamogoSvegegoTikaPoVsemSimvolam ) VremaySamogoSvegegoTikaPoVsemSimvolam= InformaziaOPoslednemTike[i].LastTick.time_msc;
Alexey Kozitsyn:

If someone received information about a tick at 17:59:01, and I didn't receive it even at 18:00, that's a big problem.

And here is the question. What is the problem (and is there one)? In the broker's server, which doesn't give the tick (to everyone) for a long time, or in MT5, which doesn't receive it for a long time.

On the one hand the average time between "TimeCurrent" and the arrival time of the last tick is 5 milliseconds, on the other hand there are ticks that come with a drop in tens of seconds. For example from 18 to 25. I have caught a tick with a delay of 45 seconds. And that's on a couple of tens of non-liquid symbols.


+ to this the term problem can be exacerbated by using CopyTicks to get the last tick.
if(CopyTicks(Symbol(),ticks,COPY_TICKS_TRADE,0,1)==1) 

Not only is it slower by times, but it may be executed flatly for a second and a half.

I have understood that OnBookEvent is suitable only for trading on one symbol.

 
pivomoe:

This is how I tried for prostotrader to carry what I see as a problem. In the last version I go through all symbols and take the maximum time of the last received tick.

On the one hand the average time between "TimeCurrent" and the arrival time of the last tick is 5 milliseconds, on the other hand there are ticks that come with a drop in tens of seconds. For example from 18 to 25. I have caught a tick with a delay of 45 seconds. And that's on a couple of tens of non-liquid symbols.


+ to this the term problem can be exacerbated by using CopyTicks to get the last tick.

Not only is it slower by times, but it may be executed flatly for a second and a half.

I have also understood that OnBookEvent is suitable only for trading on one symbol.

Here we are. It turns out that you have just understood that the market glass is formed for each currency pair separately, so trading on its data for different pairs is not possible.

I hope you'll soon realize that chasing data from various charts in a certain sequence, given by you, does not correspond to the sequence of incoming data about new ticks in charts of different currency pairs.

Therefore, if EURUSD is checked first, and BTCUSD is checked last, and there are dozens of symbols between them, the time of ticks receipt may look like this

18:50:00.000; 18:48:59.018; 18:51:00.001; 18:47:59.000 well and so on. Without any conspiracy theory, MT's or broker's faults. What they programmed is what they got.

 
Алексей Тарабанов:

Here we are. It turns out that you've just realized that the glass is formed for each currency pair separately, so to trade on its data is not possible for different pairs.

I hope you'll soon realize that chasing data from various charts in a certain sequence, given by you, does not correspond to the sequence of incoming data about new ticks in charts of different currency pairs.

Therefore, if EURUSD is checked first, and BTCUSD is checked last, and there are dozens of symbols between them, the time of ticks receipt may look like this

18:50:00.000; 18:48:59.018; 18:51:00.001; 18:47:59.000 well and so on. Without any conspiracy theory, MT's or broker's faults. What we programmed is what we got.

To catch new ticks via OnBookEvent I was inspired byprostotrade, who wrote that "it's more correct". I don't use tick itself, I just subscribe for its update for all symbols in market report.OnBookEven is used to detect only symbol which was used to update the tick. Then it is checked for a new tick and then I look if the EA has set new anti-records. That'sactually the entire function:

void OnBookEvent(const string &symbol)
  {   
   if( MestoPoluchenieTikov == ON_TIMER ) return;
//--- Ищем индекс символа для которого полученно событие OnBookEvent
   int IndeksSimvola= -1;
   for(  int i=0;  i < KolichestvoSimvolov; i++ )
   if(  symbol == GCInformaziaOPoslednemTike[i].Simvol  ) { IndeksSimvola= i; break; }
   
   if( IndeksSimvola== -1 ){Print(__FUNCTION__,"Не удалось найти символ по которому полученно событие OnBookEvent ");ExpertRemove();return;}
   
   bool PoluchiliNoviiTick= false;
          
    //--- Получаем тик заданным в настройках способом.
   if( SposobPoluchenieTikov == SYMBOL_INFO_TICK  ) PoluchiliNoviiTick= PolychaemNoviiTickSymbolInfoTick(GCInformaziaOPoslednemTike[IndeksSimvola]);
   if( SposobPoluchenieTikov == COPY_TICKS       )  PoluchiliNoviiTick= PolychaemNoviiTickCopyTicks(GCInformaziaOPoslednemTike[IndeksSimvola]);    
       
     //--- Смотрим не установлены ли новые рекорды.  
   if(  PoluchiliNoviiTick ) PitaemsayObnovitRekordi( GCInformaziaOPoslednemTike, IndeksSimvola );                 
   
   ObnovlaemInformacyyNaGrafikeEslePora();
 
  }   
Alexei Tarabanov:

I hope that you understand that chasing data from different glasses in a certain sequence, given by you, does not correspond to the sequence of incoming data about new ticks in glasses of different currency pairs.

As far as I understand, if I don't receive a cup using MarketBookGet, then I don't search anything. Perhaps, you just haven't looked at my code from the second page.

 
pivomoe:

I got the idea of catching new ticks via OnBookEvent fromprostotrade, who wrote that it's "more correct". I don't use the tick itself, I just subscribe to its updates for all symbols in the market report.OnBookEven I basically use it only to identify the symbol, for which the tick has been updated. Then it is checked for a new tick and then I look if the EA has set new anti-records. That'sactually the entire function:

As far as I understand, if I don't get the cup using MarketBookGet, then I don't check anything. You probably just haven't looked at my code from the second page.

The MT signal is not processed until the previous signal is processed.

 
pivomoe:

I got the idea of catching new ticks via OnBookEvent fromprostotrade, who wrote that it's "more correct". I don't use the tick itself, I just subscribe to its updates for all symbols in the market report.OnBookEven I basically use it only to identify the symbol, for which the tick has been updated. Then it is checked for a new tick and then I look if the EA has set new anti-records. That'sactually the entire function:

As far as I understand, if I don't get the cup using MarketBookGet, then I don't check anything. You probably just haven't looked at my code from the second page.

I haven't.

 
pivomoe:

Your logic is fine, don't listen to those who pass by.

1. Try leaving 3-5 instruments (one of which is illiquid). Will it play?

2. Run it on a clean machine with no other software using the internet. Will it repeat?

3. Try separating the latency catching into different EAs (1 per tool).

If the problem is not in resources (there was some limitation on the number of threads allocated to one terminal), then the bug should be fixed.

 
Andrey Khatimlianskii:

Your logic is fine, don't listen to those who pass by.

1. Try to keep 3-5 instruments (one of which is illiquid). Will it play?

2. Run it on a clean machine with no other software using the internet. Will it repeat?

3. Try separating the latency catching into different EAs (1 per tool).

If the problem is not with resources (there was some limitation on the number of threads allocated to one terminal), then the bug should be fixed.

Thanks for the reply. Today I have made a little progress in solving this problem. It's treated with Sleep() command between SymbolInfo() calls. Before, I just looped through the entire market overview without pausing. I tested it on 40 symbols at evening. If Sleep(5) then I catch "new tick", which should have been two seconds ago. But Sleep(10) shows a delay of 400 milliseconds (due to Sleep(10) ( 40 symbols *10 ). I tried to test it on 4 most liquid symbols at Vespers. With Sleep(1) no delay at all.... everything is perfect. Here I do not understand how it may be, if the symbol in the review is small SymbolInfo can be used without any pauses. And if the symbol is a lot of need to use pauses.

Now the answers:

1) On liquid on the evening is not played.

2) At 40 characters, it repeats even with the disabled software.

3) I do not understand what you suggest. Catch new ticks at once from two EAs in one terminal ?

I'm digging now the feasibility of calling SymbolInfo. For example I managed to find out that even one symbol in market overview is not capable of sending new ticks more than 3.5 milliseconds apart (it was at evening time though).

 
pivomoe:

1) On liquid ones, it does not play back on vespers.

2) On 40 characters it repeats even with the software disabled.

3) I don't understand what you are suggesting. Catch new ticks at once from two EAs in one terminal ?

ZZZ Now I'm digging in the direction of the feasibility of calling SymbolInfo. For example I managed to find out that even one symbol in market overview is not capable of giving new ticks more than 3.5 milliseconds (it was at evening time though).

1. Try to add an illiquid one

3. catch misses for one instrument from one EA. And run 40 EAs.

 
pivomoe:

Thank you for your reply. Got a little further today in solving this problem. It is treated with Sleep() command between SymbolInfo() calls. I used to just cycle through the entire market overview without pausing. I tested it on 40 symbols at evening. If Sleep(5) then I catch "new tick", which should have been two seconds ago. But Sleep(10) shows a delay of 400 milliseconds (due to Sleep(10) ( 40 symbols *10 ). I tried to test it on 4 most liquid symbols at Vespers. With Sleep(1) no delay at all.... everything is perfect. Here I do not understand how it may be, if the symbol in the review is small SymbolInfo can be used without any pauses. And if you have a lot of characters, you have to use pauses.

Please provide me a piece of code that catches delays. Right here, via code insert button.