Errors, bugs, questions - page 14

 
stringo:
Optimisation by bool has been corrected
OK, except I don't see any movement in the application (there were still certain nuances there)...
 
Interesting:
OK, only I don't see any movement in the application (there were still certain nuances there)...

Please wait.

The applications will synchronise after a while.

 
alexvd:

Please wait.

Applications are synchronised after a while.

It has been observed that if you remind them, the synchronisation is quicker...


PS

For example, it seems they forgot about my request #14620 (it takes too long to synchronize it)...

 

Can you tell me what I'm doing wrong? The indicators have been created for clarification.

1. I created two indicators, separately everything works (draws).

Indicator 00 (single-coloured)

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_plots   1
#property indicator_color1  Green

double      Buffer_0[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetIndexBuffer(0,Buffer_0,INDICATOR_DATA);
   PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_LINE);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int OnCalculate (const int rates_total,      // размер входных таймсерий
                 const int prev_calculated,  // обработано баров на предыдущем вызове
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[])        // Spread
  {
   if(rates_total<10) return(0);
   int  start_pos=0;   // точка старта

   if(prev_calculated==0) start_pos=rates_total-100;
   else start_pos=prev_calculated-1;
   
   for(int i=start_pos;i<rates_total;i++)
     {
     Buffer_0[i]=high[i];
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }

Indicator 11 (multi-coloured)

#property indicator_chart_window
#property indicator_buffers 2
#property indicator_plots   1
#property indicator_color1  Blue,Yellow,Red

double      Buffer_0[],Buffer_1[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
   SetIndexBuffer(0,Buffer_0,INDICATOR_DATA);
   SetIndexBuffer(1,Buffer_1,INDICATOR_COLOR_INDEX);

   PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_COLOR_LINE);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int OnCalculate (const int rates_total,      // размер входных таймсерий
                 const int prev_calculated,  // обработано баров на предыдущем вызове
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[])        // Spread
  {
   if(rates_total<10) return(0);
   int  start_pos=0;   // точка старта

   if(prev_calculated==0) start_pos=rates_total-100;
   else start_pos=prev_calculated-1;
   
   for(int i=start_pos;i<rates_total;i++)
     {
     Buffer_0[i]=low[i];
     Buffer_1[i]=1;
     if(Buffer_0[i]>Buffer_0[i-1]) Buffer_1[i]=0;
     if(Buffer_0[i]<Buffer_0[i-1]) Buffer_1[i]=2;
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  } 

I want to combine them together; I take indicator 11 (multicolor) as a base and add a buffer, like it is done in the 00 indicator

The line (Buffer_2[i]=high[i];) is not drawn, though it is calculated, I can change colour.

#property indicator_chart_window
#property indicator_buffers 3
#property indicator_plots   2
#property indicator_color1  Blue,Yellow,Red
#property indicator_color2  Green

double      Buffer_0[],Buffer_1[];
double      Buffer_2[];
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
   SetIndexBuffer(0,Buffer_0,INDICATOR_DATA);
   SetIndexBuffer(1,Buffer_1,INDICATOR_COLOR_INDEX);
   SetIndexBuffer(2,Buffer_2,INDICATOR_DATA);
   
   PlotIndexSetInteger(0,PLOT_DRAW_TYPE,DRAW_COLOR_LINE);
   PlotIndexSetInteger(2,PLOT_DRAW_TYPE,DRAW_LINE);
   return(0);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+

int OnCalculate (const int rates_total,      // размер входных таймсерий
                 const int prev_calculated,  // обработано баров на предыдущем вызове
                 const datetime& time[],     // Time
                 const double& open[],       // Open
                 const double& high[],       // High
                 const double& low[],        // Low
                 const double& close[],      // Close
                 const long& tick_volume[],  // Tick Volume
                 const long& volume[],       // Real Volume
                 const int& spread[])        // Spread
  {
   if(rates_total<10) return(0);
   int  start_pos=0;   // точка старта

   if(prev_calculated==0) start_pos=rates_total-100;
   else start_pos=prev_calculated-1;
   
   for(int i=start_pos;i<rates_total;i++)
     {
     Buffer_0[i]=low[i];
     Buffer_2[i]=high[i];// вот это не рисует
     Buffer_1[i]=1;
     if(Buffer_0[i]>Buffer_0[i-1]) Buffer_1[i]=0;
     if(Buffer_0[i]<Buffer_0[i-1]) Buffer_1[i]=2;
     }
//--- return value of prev_calculated for next call
   return(rates_total);
  }

What am I doing wrong ?

Files:
00.mq5  2 kb
11.mq5  2 kb
22.mq5  3 kb
 
Prival:

What am I doing wrong?


PlotIndexSetInteger(2,PLOT_DRAW_TYPE,DRAW_LINE);
 
Thank you.
 
sergey1294:
Вопрос был по поводу внешних параметров input , у меня в советнике их большое количество, необходимые для более гибкой настройки эксперта, так вот как только я выбираю своего эксперта из общего списка в тестере, вылетает сразу терминал. с меньшим количеством нормально.

stringo:

It is common practice to use a configuration file for settings, especially if there are many settings. But the name of the configuration file can be passed as a parameter.

A common practice (among professionals) is for the terminal to generate an error message, rather than crashing.
Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки компиляции
Документация по MQL5: Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки компиляции
  • www.mql5.com
Стандартные константы, перечисления и структуры / Коды ошибок и предупреждений / Ошибки компиляции - Документация по MQL5
 
simpleton:
The common practice (among professionals) is when the terminal gives out an error message, but not when it crashes.

I support you - Don't close the terminal or remove the EA from the chart at every opportunity (according to the developers)...


PS

Speaking of birds, there is a request #17391 just on this subject...

 
Interesting:

It's a good point, if you remind yourself, the synchronisation is quicker...


PS

For example, they seem to have forgotten about my request #14620 (it takes too long to synchronize it)...

Download the latest version of Help and look at"MQL5 Reference / Standard constants, enumerations and structures / Environment state / Tool info "
 
Rosh:
Download the latest version of help and have a look at"MQL5 Reference / Standard constants, enumerations and structures / Environment state / Tool info "

Compared the online version with the file I have. Either I'm completely blind or they're completely the same...

I take it we are talking about the next release of the terminal and a new version of help?