Errors, bugs, questions - page 548

 
ivandurak:

Good night . I'm just starting to get a good look at it. It seems to be a clear bug. I cite the code below, if I comment on one line (it is marked) it seems to work, what the problem is - I do not understand. I didn't find anything in the documentation on this subject.

You have not allocated the Raznica array. It is declared but it's not allocated memory, at the same time it is not an indicator buffer (the memory for the buffers is allocated automatically).

Here:

   SetIndexBuffer(0,BaseMaBuffer,INDICATOR_DATA);
   SetIndexBuffer(1,MaForMaBuffer,INDICATOR_DATA);

you tell the compiler that the arrays BaseMaBuffer and MaForMaBuffer are indicator buffers. The other arrays should be allocated through

ArrayResize()
Усреднение ценовых рядов без дополнительных буферов для промежуточных расчетов
Усреднение ценовых рядов без дополнительных буферов для промежуточных расчетов
  • 2010.10.25
  • Nikolay Kositsin
  • www.mql5.com
Статья о традиционных и не совсем традиционных алгоритмах усреднения, упакованных в максимально простые и достаточно однотипные классы. Они задумывались для универсального использования в практических разработках индикаторов. Надеюсь, что предложенные классы в определенных ситуациях могут оказаться достаточно актуальной альтернативой громоздким, в некотором смысле, вызовам пользовательских и технических индикаторов.
 
ivandurak:

Good night . I've just started to look into it. It seems to be an obvious bug. I cite the code below, if I comment on one line below (it is marked) then it seems to work - what is the problem? The situation can be avoided by specifying an explicit size for the Raznica[] array. I did not find anything in the documentation on this subject.

There is no bug. You should specify the size for dynamic arrays using the

int  ArrayResize(
   void  array[],              // массив, переданный по ссылке
   int   new_size,             // новый размер массива
   int   reserve_size=0        // резервное значение размера (избыточное)
   );

The function can be applied only to dynamic arrays, but you should bear in mind that dynamic arrays assigned as indicator buffers by the SetIndexBuffer() function cannot be resized. For indicator buffers, all resizing operations are performed by the executing subsystem of the terminal.


 
I got it, thanks for the smart ass-whupping. Another question, if an array is resized, what happens to the data? And also changing indexing direction as in timeseries is possible only for dynamic array?
Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
Документация по MQL5: Основы языка / Типы данных / Объект динамического массива
  • www.mql5.com
Основы языка / Типы данных / Объект динамического массива - Документация по MQL5
 
ivandurak:
I got it, thanks for the smart ass-whupping. Another question, if the array is resized, what will happen to the data? And it is possible to change an indexing direction as in timeseries only at a dynamic array?

The data will remain in place, if you reduce and then restore, it is uncertain (the result is undefined).

By the way indexing direction changes only index reference, the array is distributed in the same direction.

That is, data cannot be shifted by re-partitioning the array.

 

This has already been reported, but the tester keeps resetting the user-defined initial deposit value by $10,000.

The available set of initial values is quite crooked. Would add at least $1000 to it.

build 523

Win XP

 
Was it like this, or did something break... In general, free access to the protected method in non-descendants is allowed
#include <Arrays/List.mqh>
//---------------------------------------
class CBasket;

class CFruit: public CObject {
private:
        double _weight;
protected:
        double GetWeight(){return _weight;}     
public:
        CFruit(double weight){_weight = weight;};
        ~CFruit(){};
};
//---------------------------------------
class CBasket {
private:
        CList _fruits;
protected:
public:
        CBasket(){};
        ~CBasket(){};
        double Weight() {
                double weight = 0;
                for(CFruit* f = _fruits.GetFirstNode(); f != NULL; f = _fruits.GetNextNode()) {
                        weight += f.GetWeight(); //свободный вызов protected метода другого класса
                }
                return weight;
        }
        
        void Attach(CFruit* f) {
                _fruits.Add(f);
        }
};
//---------------------------------------
int OnInit() {
        CBasket* b = new CBasket();
        
        CFruit* f1 = new CFruit(3.5);
        CFruit* f2 = new CFruit(6.5);
        b.Attach(f1);
        b.Attach(f2);
        Print(b.Weight());
      
   return(0);
}
//---------------------------------------
 

After optimisation, the results file cannot be opened,

Build 527 + Office 2007

The error log contains the following data


XML error in "Table"
Cause: Erroneous value.
File: C:\Users\Dragon\Desktop\ReportOptimizer-957640.xml
Group: Cell
Tag: Data
Значение: 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000

XML error in "Table".
Cause: Erroneous value
File: C:\Users\Dragon\Desktop\ReportOptimizer-957640.xml
Group: Cell
Tag: Data
Значение: 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000

XML error in "Table".
Cause: Erroneous value
File: C:\Users\Dragon\Desktop\ReportOptimizer-957640.xml
Group: Cell
Tag: Data
Значение: 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000

XML error in "Table".
Cause: Erroneous value
File: C:\Users\Dragon\Desktop\ReportOptimizer-957640.xml
Group: Cell
Tag: Data
Значение: 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000

XML error in "Table".
Cause: Erroneous value
File: C:\Users\Dragon\Desktop\ReportOptimizer-957640.xml
Group: Cell
Tag: Data
Значение: 179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0000

etc.

 

I think you are getting an empty value.

You can read

https://www.mql5.com/ru/docs/constants/namedconstants/otherconstants

EMPTY_VALUE

Empty value in indicator buffer

DBL_MAX

DBL_MAX

Maximum value that can be represented by double type

1.7976931348623158e+308

Документация по MQL5: Стандартные константы, перечисления и структуры / Именованные константы / Прочие константы
Документация по MQL5: Стандартные константы, перечисления и структуры / Именованные константы / Прочие константы
  • www.mql5.com
Стандартные константы, перечисления и структуры / Именованные константы / Прочие константы - Документация по MQL5
 
Vigor:
Was it like this, or did something break... Anyway, it's allowed to freely access the protected method in non-descendants

Thanks for the post, bug fixed, fix will go into the next build.
 
Karlson:

I think you are getting an empty value.

You can read

https://www.mql5.com/ru/docs/constants/namedconstants/otherconstants

EMPTY_VALUE

Empty value in indicator buffer

DBL_MAX

DBL_MAX

Maximum value that can be represented by double type

1.7976931348623158e+308

And how can empty values get into the file? In the tester window there are normal optimization results.