Discussion of article "Electronic Tables in MQL5"

 

New article Electronic Tables in MQL5 is published:

The article describes a class of dynamic two-dimensional array that contains data of different types in its first dimension. Storing data in the form of a table is convenient for solving a wide range of problems of arrangement, storing and operation with bound information of different types. The source code of the class that implements the functionality of working with tables is attached to the article.

Author: Николай

 
Good, kind, useful article. Respect to the author!
 
Interesting. Might even come in handy.
 

Eh... I'd like to see a small example of how to order the second column in a 3x3 two-dimensional array. What should I write in the code after #include <Table.mqh>?

The following code outputs zeros. Where is the error?

#include <Table.mqh>
void OnStart(){   
   ENUM_DATATYPE Types[3];
   Types[0] = TYPE_DOUBLE;
   Types[1] = TYPE_DOUBLE;
   Types[2] = TYPE_DOUBLE;   
   CTable Table;
   Table.FirstResize(Types);
   Table.SecondResize(3);
   Table.Set(0,0, 1); Table.Set(0,1, 4); Table.Set(0,2, 23);
   Table.Set(1,0, 2); Table.Set(1,1, 7); Table.Set(1,2, 48);
   Table.Set(2,0, 3); Table.Set(2,1, 1); Table.Set(2,2, 77);
   Table.SortTwoDimArray(1,0,Table.SecondSize()-1);
   string txt;
   for(int i=0; i<Table.SecondSize(); i++){
      for(int j=0; j<Table.FirstSize(); j++){
         double k;
         Table.Get(i,j,k);
         StringConcatenate(txt, txt, "  ", DoubleToString(k));
      }
      Print(txt);
      txt="";
   }
}//OnStart()
 

You are assigning int type to table fields declared as double

try this or this...

   Table.Set(0,0, 1.); Table.Set(0,1, 4.); Table.Set(0,2, (double)23);
   Table.Set(1,0, 2.); Table.Set(1,1, 7.); Table.Set(1,2, (double)48);
   Table.Set(2,0, 3.); Table.Set(2,1, 1.); Table.Set(2,2, (double)77);
 
Oh, thank you! I never would have guessed that.
 

Nikolay, I have a question.

Is it possible to write a table from MT5 to Excel in this form?

I am interested in those 2 macro column names ("Absolute data" and "Relative data"), which are highlighted in colour. They unite 3 cells each.

Maybe I want a lot from MQL5 in terms of formatting excel cells. What if :-)))

 
denkir:

Nikolay, I have a question.

Is it possible to write a table from MT5 to Excel in this form?

I am interested in those 2 macro column names ("Absolute data" and "Relative data"), which are highlighted in colour. They combine 3 cells each.

Maybe I want a lot from MQL5 in terms of formatting excel cells. But what if :-)))

What physical meaning do you put in the words "combine 3 cells" ?

In principle you can but without the top 2 rows, data types are summarised by columns, so that in one column to cram string and double will not work, but it can be done when printing. Or to refine the class so that it contains capital strings formatted separately from the table.

The easiest way is to create two tables and merge them.

Документация по MQL5: Основы языка / Типы данных
Документация по MQL5: Основы языка / Типы данных
  • www.mql5.com
Основы языка / Типы данных - Документация по MQL5
 
Urain:

What physical meaning do you put into the words "combine 3 cells" ?


This is what we have now:



What I would like to have already brought ....

 
Privit, zhuzhe viruchila biblioteka z statti"Spreadsheets in MQL5", thank you.
 
MetaQuotes Software Corp.:

New article Electronic Tables in MQL5 is published:

Author: Николай

Nice. This is what I am looking for. Will try my columns. Thanks.