Indicators: Open Interest - page 2

To add comments, please log in or register
miillad
31
miillad  
In my country there is a new year's holiday and the market is closed. When I open the market, I'll show you a picture
miillad
31
miillad  
I may ask you to introduce the symbol and the broker your tested this indicator on the so that I will add it to MetaTrader.
Amalamal2018
6
Amalamal2018  
miillad:

Hi.

Thank you for constructing this indicator.

But this indicator has a delay tick. Are you fixing this problem please?

Done sir briefest
miillad
31
miillad  
Example
Files:
tik1.jpg 198 kb
tik2.jpg 194 kb
tik3.jpg 190 kb
Vladimir Karputov
Moderator
151000
Vladimir Karputov  
miillad:
Example

1. Пожалуйста ВСТАВЛЯЙТЕ картинку. ПРИКРЕПЛЯТЬ картинку - неправильное действие.

2. Я в пятый раз прошу Вас: "Покажи код, с помощью которого Вы выводите на экран данные".

miillad
31
miillad  
Vladimir Karputov:

1. Пожалуйста ВСТАВЛЯЙТЕ картинку. ПРИКРЕПЛЯТЬ картинку - неправильное действие.

2. Я в пятый раз прошу Вас: "Покажи код, с помощью которого Вы выводите на экран данные".

//+------------------------------------------------------------------+
//|                                                Open Interest.mq5 |
//|                              Copyright © 2016, Vladimir Karputov |
//|                                           http://wmua.ru/slesar/ |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2016, Vladimir Karputov"
#property link      "http://wmua.ru/slesar/"
#property version   "1.001"
#property indicator_separate_window
#property indicator_buffers 4
#property indicator_plots   2
//--- plot Max
#property indicator_label1  "Interest Max"
#property indicator_type1   DRAW_HISTOGRAM2
#property indicator_color1  clrBlue
#property indicator_style1  STYLE_SOLID
#property indicator_width1  3
//--- plot Сurrent
#property indicator_label2  "Interest Min"
#property indicator_type2   DRAW_HISTOGRAM2
#property indicator_color2  clrRed
#property indicator_style2  STYLE_SOLID
#property indicator_width2  3
//--- indicator buffers
double         BufferMaxUp[];
double         BufferMaxDown[];
double         BufferMinUp[];
double         BufferMinDown[];
//---
datetime       StartDate=0;
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   Print(__FUNCTION__);
//--- indicator buffers mapping
   SetIndexBuffer(0,BufferMaxUp,INDICATOR_DATA);
   SetIndexBuffer(1,BufferMaxDown,INDICATOR_DATA);
   SetIndexBuffer(2,BufferMinUp,INDICATOR_DATA);
   SetIndexBuffer(3,BufferMinDown,INDICATOR_DATA);
   ArraySetAsSeries(BufferMaxUp,true);
   ArraySetAsSeries(BufferMaxDown,true);
   ArraySetAsSeries(BufferMinUp,true);
   ArraySetAsSeries(BufferMinDown,true);
//---
   PlotIndexSetDouble(0,PLOT_EMPTY_VALUE,0);
   PlotIndexSetDouble(1,PLOT_EMPTY_VALUE,0);
   PlotIndexSetDouble(2,PLOT_EMPTY_VALUE,0);
   PlotIndexSetDouble(3,PLOT_EMPTY_VALUE,0);
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
   if(prev_calculated==0)
     {
      Print("prev_calculated==0, StartDate=",StartDate);
      if(StartDate<D'2015.01.01 00:00')
        {
         StartDate=TimeCurrent();
        }
      else
        {
         return(rates_total);
        }
     }
//---
   double interest=SymbolInfoDouble(Symbol(),SYMBOL_SESSION_INTEREST);
   Comment("Open interest= ",interest);
//---
   int limit=rates_total-prev_calculated;
   for(int i=0;i<limit;i++) // в случае когда prev_calculated==0 или когда limit>1
     {
      BufferMaxUp[i]=interest;
      BufferMaxDown[i]=interest;
      BufferMinUp[i]=interest;
      BufferMinDown[i]=interest;
     }
//---
   if(interest>BufferMaxUp[0])
     {
      BufferMaxUp[0]=interest;
     }
   if(interest<BufferMinDown[0])
     {
      BufferMinDown[0]=interest;
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
maboudi
29
maboudi  

Hi, 

I downloaded the zip file and extracted it: I only have a small 8 Ko file, I don't know in wich farmat. How can I do, please.

Thank you in advance.

Vladimir Karputov
Moderator
151000
Vladimir Karputov  
maboudi:

Hi, 

I downloaded the zip file and extracted it: I only have a small 8 Ko file, I don't know in wich farmat. How can I do, please.

Thank you in advance.

How to download code from MetaEditor

Toolbox - Workspace - MetaTrader 5
Toolbox - Workspace - MetaTrader 5
  • www.metatrader5.com
Double-click an error message, to open an appropriate file. The cursor is immediately set to the error location. A similar action is performed using the Go to Line command in the context menu. Search The search is performed using the toolbar and the Online Search command in the Help menu. Search results are conveniently displayed by categories...
maboudi
29
maboudi  

I'm using MT4, can it work?

Vladimir Karputov
Moderator
151000
Vladimir Karputov  
maboudi:

I'm using MT4, can it work?

Open Interest - indicator for MetaTrader 5

123
To add comments, please log in or register