[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 457

 
ilunga:
exactly

I modified the script a little bit:

//+------------------------------------------------------------------------------------------+
//|                                                                     ArraySetAsSeries.mq4 |
//+------------------------------------------------------------------------------------------+
//|                         script program start function                                    |
//+------------------------------------------------------------------------------------------+
//------------------------------------ НАЧАЛО START -------------------------------------- 1 -
int start()                                                              //функция start
  {                                                                      //начало start
   double Timestart=GetTickCount();                                      //переменная, с помощью которой вычисляется время (в милисекундах) начала выполнения скрипта
   double array1[][6];                                                   //объявляем массив-источник (массив, из к-о будут скопированы данные)
   double array2[][6];                                                   //объявляем массив-приемник (массив, куда будут скопированы данные), к-й на
                                                                         //момент объявления заполнен некоторыми данными
   int element_1=ArrayCopyRates(array1);                                 //копируем данные баров текущего графика в массив array1 
   int element_2=ArrayCopy(array2,array1,0,0,WHOLE_ARRAY);               //копируем данные всех баров в пользовательский массив
   bool element_3=ArrayGetAsSeries(array2);                              //проверка: является ли массив array1 массивом-таймсерией
   bool try_1=ArraySetAsSeries(array2,false);                            //устанавливаем НАПРАВЛЕНИЕ индексирования массива  
   bool element_4=ArrayGetAsSeries(array2);                              //проверка: является ли массив array2 массивом-таймсерией
   double element=array2[0][1];                                          //получаем значение цены открытия нулевого бара
//----------------------------------------------------------------------------------------- 2 -
   Comment("\nФункция ArrayCopyRates(array1) вернула: ",element_1,
           "\nФункция ArrayCopy(array2,array1,0,WHOLE_ARRAY) вернула: ",element_2,
           "\nФункция ArrayGetAsSeries(array2) вернула: ",element_3,
           "\nФункция ArraySetAsSeries(array2;false) вернула: ",try_1,
           "\nФункция ArrayGetAsSeries(array2) вернула: ",element_4,
           "\nЦена открытия нулевого бара (т.е. бара с ИНДЕКСОМ 0) равна: ",element,
           "\nСкрипт выполнялся всего ",GetTickCount()-Timestart," миллисекунд, из них: ",
           MathFloor((GetTickCount()-Timestart)/1000)," секунд ",((GetTickCount()-Timestart)/1000-MathFloor((GetTickCount()-Timestart)/1000))*1000,
           " миллисекунд");//печать сообщения на экран
//----------------------------------------------------------------------------------------- 3 -
   return(0);                                                             //выход из start
  }                                                                       //конец start
//-------------------------------------- КОНЕЦ START -------------------------------------- 4 -

The result is as follows:


A question naturally arose: In this case I copied data of bars in the current chart into a two-dimensional array array1 using the ArrayCopyRates(array1) function. Then in the next line with function ArrayCopy(array2,array1,0,0,WHOLE_ARRAY) I copied data of array1 into array2. Then, using the ArrayGetAsSeries function, I checked whether array2 is an array-timeseries. And it turned out (as you can see from the screenshot), that the array is a timeseries array, although I hadn't "processed" it with ArraySetAsSeries function before.

Question: why in the first case (previous question) I needed to use ArraySetAsSeries function (to make my array be organized as a timeseries array), while in this case I don't need such processing.

P.S. Sorry for the insistence, I just want to understand it completely, so that no "gaps in history" are left. Thanks for all the previous replies.

 
7777877:

I've changed the script a little bit:


double array1[][6];                                                   //объявляем массив-источник (массив, из к-о будут скопированы данные)
double array2[][6];                                                   //объявляем массив-приемник (массив, куда будут скопированы данные), к-й на
Immediately a question. Why is the array two-dimensional?
 
ilunga:
Immediately a question. Why is the array two-dimensional?
I mean, why did I decide to copy exactly into a two-dimensional array...? I was just experimenting with the functions given in the Documentation in the Array Functions section. Since I've used almost all (or almost all) functions of that section with almost the same algorithm (to understand what works and how), I've compared results returned by ArrayGetAsSeries function when copying into one- and two-dimensional arrays, and saw the difference. Since I was unable to understand the reason for such a difference, I asked the following question
 
7777877:
I mean, why did I decide to copy exactly into a two-dimensional array...? I just experimented with the functions given in the Documentation in the Array Functions section. Since I've used almost all (or almost all) functions of that section with almost the same algorithm (to understand what works and how), I've compared results returned by ArrayGetAsSeries function when copying into one- and two-dimensional arrays, and saw the difference. Since I was unable to understand the reason for such a difference, I asked the following question
Are you sure that using functions "not intended for" you will understand something you need?
 

how to stop an advisor working?

 
ilunga:
Are you sure that using functions "out of order" you will understand something you need?

Honestly:

1. At this stage I am not sure about anything at all (I am just trying to figure it out), because if I were sure, I would not be asking questions

2. I don't fully understand the question: what does "not intended" mean? The description of the ArrayGetAsSeries function doesn't list functions to which it can or cannot be applied. So I concluded that there's nothing wrong with applying the ArrayGetAsSeries function to a two-dimensional array.

 
7777877:

Honestly:

1. At this stage I am not sure about anything at all (I am just trying to figure it out), because if I were sure, I would not be asking questions

2. I don't fully understand the question: what does "not intended" mean? The description of the ArrayGetAsSeries function doesn't list functions to which it can or cannot be applied. So I concluded that there's nothing wrong with applying the ArrayGetAsSeries function to a two-dimensional array.

Of course, there's nothing wrong with it. Here is the description:

bool ArrayGetAsSeries( object array[])

Returns TRUE if array is organized as timeseries(array elements are indexed from last to first), otherwise returns FALSE.

Input parameter is an array. One dimensional

 
ilunga:

Of course you don't. Look at the description:

bool ArrayGetAsSeries( object array[])

Returns TRUE if array is organized as timeseries (array elements are indexed from last to first), otherwise returns FALSE.

Input parameter is an array. One dimensional

Maybe I'm looking in the wrong place: https://docs.mql4.com/ru/array/ArrayGetAsSeries? Not here (that the array is exactly one-dimensional)
 
7777877:
Maybe I'm looking in the wrong place: https://docs.mql4.com/ru/array/ArrayGetAsSeries? Not here (that the array is exactly one-dimensional)
the square brackets are alone
 
Elektronik:

how to stop an advisor working?

Right click on the smiling face (in the top right corner of the client terminal window) -> Advisors -> Remove
Reason: