Lagging OI (open interest)

 

Why in terminal change of open interest:
SymbolInfoDouble(Symbol(),SYMBOL_SESSION_INTEREST)
lives its life relative to the tape?
void OnBookEvent(const string& symbol)

As far as I understand the futures market, transactions in the ribbon may not cause OI to change. But why does the OI change by itself without any transactions?
This has already been seen before:
https://www.mql5.com/ru/forum/165157/page2#comment_3989978

OI in the terminal is updated with what periodicity, what does it depend on?
How do I synchronize OI changes with trades in the feed? I want to get a complete feed with OI.

Открытый Интерес на истории
Открытый Интерес на истории
  • 2016.12.30
  • www.mql5.com
Здравствуйте, уважаемая администрация...
 
small Expert Advisor that marks events in the log:
1. new tick
2. new deal in the feed
3. change of OI (with 1ms accuracy)
it shows that OI changes happen by itself without ticks and without deals in the feed.
long bool_event_time_last = 0;

int OnInit() {
   EventSetMillisecondTimer(1);
   MarketBookAdd(_Symbol);
   
   MqlTick tick[];
   CopyTicks(_Symbol,tick,COPY_TICKS_ALL,0,1);
   bool_event_time_last = tick[0].time_msc;

   return(INIT_SUCCEEDED);
}

void OnDeinit(const int reason) {
   EventKillTimer();
}

void OnTick() {
   Print("1. tick");
}

void OnTimer() {
   static double open_last = SymbolInfoDouble(Symbol(),SYMBOL_SESSION_INTEREST);
   double open_current = SymbolInfoDouble(Symbol(),SYMBOL_SESSION_INTEREST);
   if(NormalizeDouble(open_current,0) != NormalizeDouble(open_last,0)) {
      open_last = open_current;
      Print("3. oi change");
   }
}

void OnBookEvent (const string& symbol) {
   MqlTick tick[];
   int ticks = CopyTicks(_Symbol,tick,COPY_TICKS_ALL,0,100);
   if(ticks<20) return;
   for(int i=ticks-1;i>=0;i--) {
      if(tick[i].time_msc <= bool_event_time_last) break;
      if((int)tick[0].flags<32) continue;
      Print("2. book deal");
   }
   bool_event_time_last = tick[ticks-1].time_msc;
}
Files:
 
Alena Lysenkova:
A small EA that marks events in the log:
1. new tick
2. new deal in the feed
3. change of OI (with 1ms accuracy)
It shows that OI changes happen by themselves without ticks and without deals in the feed.

Did you write the code yourself?

 
Alena Lysenkova:

Why in terminal change of open interest:
SymbolInfoDouble(Symbol(),SYMBOL_SESSION_INTEREST)
lives its life relative to the tape?
void OnBookEvent(const string& symbol)

That's how it's designed.

Hardly possible to synchronize, there's not enough information.

 
Alena Lysenkova:

Why in terminal change of open interest:
SymbolInfoDouble(Symbol(),SYMBOL_SESSION_INTEREST)
lives its life relative to the tape?
void OnBookEvent(const string& symbol)

As far as I understand the futures market, transactions in the ribbon may not cause OI to change. But why does the OI change by itself without any transactions?
This has already been seen before:
https://www.mql5.com/ru/forum/165157/page2#comment_3989978

OI in the terminal is updated with what periodicity, what does it depend on?
How do I synchronize OI changes with trades in the feed? I want to have a full-fledged feed with OI.

If you want a full orderlog, connect through the Plaza. MT5 is unlikely to be redesigned for stock flows.

Another question is whether you need that full info.

 

@Andrey Khatimlianskii @Dmitriy Skub

Maybe there's no synchronization in the terminal, but with the code that

presented, is there anything to talk about?

Andrey Khatimlianskii
Andrey Khatimlianskii
  • www.mql5.com
Профиль трейдера
 
prostotrader:

@Andrey Khatimlianskii @Dmitriy Skub

Maybe there's no synchronization in the terminal, but with the code that

presented, is there anything to talk about?

Michael, I didn't look at the code))
 
prostotrader:

@Andrey Khatimlianskii @Dmitriy Skub

Maybe there's no synchronization in the terminal, but with the code that

Is it possible to talk about anything?

What exactly about this code do you find unsatisfactory?

 
Alena Lysenkova:

What exactly is wrong with the code?

Everything from...

CopyTicks(_Symbol,tick,COPY_TICKS_ALL,0,1);

You don't need a timer at all.

It's a masterpiece.

if(ticks<20) return;

and so on...

 
prostotrader:

Everything from.

There's no need for a timer at all.

It's a masterpiece.

and so on...

It's very professional to poke around the code you've built on your knees in a couple of minutes to show the essence of the matter.

The timer is needed there, read the topic carefully

 
Alena Lysenkova:

It's very professional to poke around in code that you've built on your own in a couple of minutes in order to show the essence of the issue.

It needs a timer, read the thread carefully.

The timer is NOT needed.

OnBookEvent is not triggered only when a transaction happens.

and you MUST filter the symbol in this function

void OnBookEvent (const string& symbol)
{
  if(symbol == Symbol())
  {
    
.. 
  }
}

This function "fills" everything that is in the market review.

Why post "bare knees"?

Added

"Very professional" to take the job

100.00 USD
Нужен софт для отслеживания ленты сделок по каждому тику с указанием изменения ОИ (аналог Time&Sales в платформе Volfix)
And not knowing how to do it.
Reason: