Obtaining Open Interest values not for the current bar

 

For the current bar, getting open interest is not a problem:

   double oi_buy=SymbolInfoDouble(Symbol(),SYMBOL_SESSION_BUY_ORDERS_VOLUME);
   double oi_sell=SymbolInfoDouble(Symbol(),SYMBOL_SESSION_SELL_ORDERS_VOLUME);

But how do you get open interest for other bars (not for the current bar - the rightmost one)?

Forum on trading, automated trading systems and strategy testing

How to get the Open Interest values not for the current bar

Karputov Vladimir, 2016.09.05 11:16

So it's like this. Here is the correlation between MetaTrader 5 and Quick:

MetaTrader 5Kvik
Total volume of buy orders at the momentTotal demand
Total volume of sell orders at the momentTotal supply

100% match in numbers.


 
Karputov Vladimir:

For the current bar, getting open interest is not a problem:

But how do you get open interest for other bars (not for the current bar - the rightmost one)?

This is not for the current bar, but for the current moment. In a second it will be the same bar, but with a different value of Open Interest. As far as I understand, this value is not stored in the history. That is why there is no way, but to collect statistics online.
 

From https://www.mql5.com/ru/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_double

SYMBOL_SESSION_BUY_ORDERS_VOLUME

Общий объём ордеров на покупку в текущий момент

double

SYMBOL_SESSION_SELL_ORDERS_VOLUME

Общий объём ордеров на продажу в текущий момент

double

What is meant by"Total volume of orders"? Is it the total volume of the gangs of one side of the stack? Or is it the total one-sided position of all exchange clients?

Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте
Документация по MQL5: Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте
  • www.mql5.com
Стандартные константы, перечисления и структуры / Состояние окружения / Информация об инструменте - справочник по языку алгоритмического/автоматического трейдинга для MetaTrader 5
 
Karputov Vladimir:

For the current bar, getting open interest is not a problem:

But how do you get open interest for other bars (not for the current bar - the rightmost one)?

Save to file, then read from it. There is no other way.
 
fxsaber:

From https://www.mql5.com/ru/docs/constants/environment_state/marketinfoconstants#enum_symbol_info_double

What is meant by"Total volume of orders"? Is it the total volume of the bands of one side of the betting market? Or is it the total one-sided position of all exchange clients?

Total volume of orders placed on the exchange (does not depend on bars and comes to the terminal with each pack of ticks)
 
prostotrader:
Total volume of orders placed on the exchange (does not depend on bars and comes to the terminal with each pack of ticks)
If I sum up the ganks of the ticks on one side, do I get the corresponding OI?
 
Ihor Herasko:
But it is not for the current bar, but for the current moment. In a second it will be the same bar, but with another value of Open Interest. As far as I understand, this value is not stored in the history. Therefore, there is no way, but to collect the statistics online.

Actually OHLC is also a momentary price value: "Open" - at the moment of bar opening, "Close" - at the moment of bar closing.

Dmitriy Skub:
Save to file, then read from it. There is no other way.

It either is or it is the collector of Open Interest for all its pairs on VPS.

 

Open Interest Ribbon indicator

Added: Zeroing of variables, during initialization.

Added:

Replace COPY_TICKS_TRADE with COPY_TICKS_ALL.

Added ChartRedraw(ChartID()) function;

Files:
OILent.mq5  10 kb
 
Karputov Vladimir:

Either that or put an open interest collector on the VPS for all pairs.

You can also get it from ready-made sources. I remember there are archives on finam.
 
fxsaber:
If I sum up the gangs of the tumbler on one side, do I get the corresponding OI?
No, because there are only 20 values each in the glass.
 
Dmitriy Skub:
You can also get it from ready-made sources. I remember there are archives on finam.
Why?! All historical information on open interest is contained in the tick history.
Reason: