[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 110

 
Good evening, another question has arisen. Here's part of the code:
#property indicator_separate_window
#property indicator_buffers 2
#property indicator_color1 Blue
#property indicator_color2 Red
#property indicator_width1 1
#property indicator_width2 1

extern string Symbol1.Name = "EURUSD";     // Название инструмента 1
extern bool   Symbol1.Reverse = false;     // Является ли инструмент 1 реверсивным (с обратной корреляцией) 
                                           // по отношению к остальным инструментам
extern string Symbol2.Name = "EURUSD";     // Название инструмента 2
extern bool   Symbol2.Reverse = false;     // Является ли инструмент 2 реверсивным (с обратной корреляцией) 

extern int MA.Slow = 80;                   // Период медленной МА

// Буферы для отображения данных
double Buf1[];    // Первый инструмент
double Buf2[];    // Второй инструмент

// Параметры графических объектов        
string Label.Name = "label";  
int wndNum;                                // Номер подокна индикатора
string wndName;                            // Наименование окна
string oSymb1,oSymb2;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() { 
  // Задаем имена графическим объектам
  oSymb1=Symbol1.Name;
  oSymb2=Symbol2.Name;

  // Формируем свойства графиков индикатора
  IndicatorBuffers(2);
  
  SetIndexStyle(0,DRAW_LINE);
  SetIndexBuffer(0,Buf1);
  SetIndexLabel(0,Symbol1.Name);

  SetIndexStyle(1,DRAW_LINE);
  SetIndexBuffer(1,Buf2);
  SetIndexLabel(1,Symbol2.Name);

  return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()  {
  // Удаляем все графические объекты
  DeleteObject(oSymb1);
  DeleteObject(oSymb2); 
  return(0);  
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  // Подсчет количества баров для построения индикатора
  int limit; int counted_bars=IndicatorCounted();
  if(counted_bars<0) return(-1);
  if(counted_bars>0) counted_bars--; 
  limit=Bars-counted_bars;
  
  // Определяем параметры окна индикатора
  wndNum=WindowFind(WindowExpertName());
  wndName=WindowExpertName()+wndNum; 
  //------------------------------------------------------------------ 
  // Отрисовка ценовых линий: рисуем и синхронизируем по наличию баров
  for(int i=0; i<limit; i++) { 
    Buf1[i]= iMA(Symbol1.Name,0,MA.Slow,0,MODE_SMA,PRICE_CLOSE,i); }
    
  for (i=0; i<limit; i++) {
    Buf2[i]= iMAOnArray(Buf1,0,MA.Slow,0,MODE_SMA,i); }
How to make Buf1 not to be displayed in the indicator window at all?
 
Arles:
Good evening, another question has arisen. Here is a part of the code: How to make Buf1 not to be displayed in the indicator window at all?

We need to change

  SetIndexStyle(0,DRAW_NONE);
  SetIndexBuffer(0,Buf1);
  SetIndexLabel(0,Symbol1.Name)
 
r772ra:

A change must be made


Thank you!!!
 
However, it doesn't fit. It turns out that this line is still there, albeit invisible. And it affects the vertical scale. But the vertical scale should be calculated only by Buf2.
 
Arles:
Good evening, another question has arisen. Here is a part of the code: How to make Buf1 not to be displayed in the indicator window at all?

#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 Blue
#property indicator_width1 1

extern string Symbol1.Name = "EURUSD";     // Название инструмента 1
extern bool   Symbol1.Reverse = false;     // Является ли инструмент 1 реверсивным (с обратной корреляцией) 
                                           // по отношению к остальным инструментам
extern string Symbol2.Name = "EURUSD";     // Название инструмента 2
extern bool   Symbol2.Reverse = false;     // Является ли инструмент 2 реверсивным (с обратной корреляцией) 

extern int MA.Slow = 80;                   // Период медленной МА

// Буферы для отображения данных
double Buf1[];    // Первый инструмент
double Buf2[];    // Второй инструмент

// Параметры графических объектов        
string Label.Name = "label";  
int wndNum;                                // Номер подокна индикатора
string wndName;                            // Наименование окна
string oSymb1,oSymb2;

//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int init() { 
  // Задаем имена графическим объектам
  oSymb1=Symbol1.Name;
  oSymb2=Symbol2.Name;

  // Формируем свойства графиков индикатора
  IndicatorBuffers(2);
  
  SetIndexStyle(0,DRAW_LINE);
  SetIndexBuffer(0,Buf2);
  SetIndexLabel(0,Symbol1.Name);

  SetIndexBuffer(1,Buf1);

  return(0);
}

//+------------------------------------------------------------------+
//| Custom indicator deinitialization function                       |
//+------------------------------------------------------------------+
int deinit()  {
  // Удаляем все графические объекты
  DeleteObject(oSymb1);
  DeleteObject(oSymb2); 
  return(0);  
}

//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int start() {
  // Подсчет количества баров для построения индикатора
  int limit; int counted_bars=IndicatorCounted();
  if(counted_bars<0) return(-1);
  if(counted_bars>0) counted_bars--; 
  limit=Bars-counted_bars;
  
  // Определяем параметры окна индикатора
  wndNum=WindowFind(WindowExpertName());
  wndName=WindowExpertName()+wndNum; 
  //------------------------------------------------------------------ 
  // Отрисовка ценовых линий: рисуем и синхронизируем по наличию баров
  for(int i=0; i<limit; i++) { 
    Buf1[i]= iMA(Symbol1.Name,0,MA.Slow,0,MODE_SMA,PRICE_CLOSE,i); }
    
  for (i=0; i<limit; i++) {
    Buf2[i]= iMAOnArray(Buf1,0,MA.Slow,0,MODE_SMA,i); }
 

How to make this EA not close orders in batches.

I want it to close one order at a time.

Files:
urdalau1.mq4  21 kb
 
alex12:


It should close one order at a time.

strange-incomplete TOR
 
Vinin:


Thank you very much! Just what I needed!
 
sergeev:
oddly incomplete ToR

this is not a ToR, but a question for the pros so as not to clutter up the forum
 
alex12:
This is not a ToR, but a question for a pro, not to clutter up the forum.

How can a pro answer it, if it is not a full TOR.

If this is not a complete ToR, then place return from the loop where you delete/close orders.

And if you go....