[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 385

 
nadya:
Of course it can, if your variable is of the appropriate type
One cell. But like this, only with constants: "arrays are initialized with a one-dimensional sequence of constants listed separated by commas. The sequence is surrounded by curly braces. "
 
kifa911:
Good afternoon, I have a question about the initialization of arrays. It is written in the tutorial that: An array can only be initialised with constants of the appropriate type. One-dimensional and multidimensional arrays are initialized with a one-dimensional sequence of constants listed separated by commas. The sequence is surrounded by curly braces. In this case I am confused by the word "constant". Can't a certain array index be assigned a value via a variable.

assignment is possible, but not during initialisation.

That is, the situation:

int aaa = 4;
int bbb[5] = {0, 1, 2, 3, 0};
bbb[4] = aaa;

allowed

And the situation

int aaa = 4;
int bbb[5] = {0, 1, 2, 3, aaa};

will cause an error

 
nadya:
of course it can, if this variable of yours has the appropriate type

Then here's a question. a function has to pass two arrays of data by reference, for example:

void SomeFunction(int& firstmassive[][3],double& secondmassive[][3])

{

 int iCount=-1,

      ifirst,isecond,ithird;

 double dfirst,dsecond,dthird;

...

 iCount++;

  firstmassive[iCount][0]=ifirst;firstmassive[iCount][1]=isecond;firstmassive[iCount][2]=ithird;

  secondassive[iCount][0]=dfirst;secondmassive[iCount][1]=dsecond;secondmassive[iCount][2]=dthird;

  print("iCount= "+iCount+" firstmassive_2= "+firstmassive[iCount][1]+" isecond= "+isecond);

...

return(0);

}

When I release this function to work, the "experts" tab in the termenal messages such as:

iCount= 0 firstmassive_2= 0 isecond= =15
iCount= 1 firstmassive_2= 0 isecond= =25
It turns out that no value of the variable is passed to the array, although the latter has a value. What have I done wrong?
 
artmedia70:

The name of the plug-in file is: GetExstremumZZZPrice.mqh ???

It lies in the terminal folder Terminal_folder/experts/include ???


The name is the same, it was in the libraries folder, now it is in the includ folder, but the result is the same
 
kifa911:

Then here's a question. a function has to pass two arrays of data by reference, for example:

When I release this function to work, the "experts" tab in the thermal shows messages of this kind, e.g:

It turns out that no variable value is passed to the array, even though the latter has a value. What have I done wrong?

I don't see the error. maybe someone else can help you
 
Again, please explain the file operations. After writing some information to a file , is it possible to remove it from the file partially? Let's say you wrote some lines in a text document and then you can delete unnecessary lines or correct them using file operations functions?
 
fore-x:
Again, please explain the file operations. After writing some information to a file, is it possible to remove it from the file partially? Let's say you wrote some lines in a text document and then you can delete unnecessary lines or correct them using file operations functions?
You can.
 
Zhunko:
You can.
  if(text != " ") 
    {
    handle = FileOpen(filename,FILE_CSV|FILE_READ|FILE_WRITE, ';'); //открыл файл
    FileSeek(handle,0,SEEK_SET );                               //переместил указатель   
    while(FileIsEnding(handle)==false)                              
      {
      pos = StringFind(FileReadString(handle),symb, 0);             //нашел нужную строку...  
      if(pos >= 0)break;                                   //...файловый указатель в конце строки
      if(FileIsEnding(handle)==true) break;                            
      }
                                 
      ?????????????????? //тут что делать, как удалить или перезаписать выбранную строку
    
    FileWrite(handle,text);     //записываем новую строку
    FileClose(handle);          //закрываем файл
    }  
Please guide me. What do I have to do now, get to the beginning of the line? And then what?
 
kifa911:
Good afternoon, I have a question about the initialisation of arrays. In the tutorial it is written that: An array can be initialized only by constants of the appropriate type. One-dimensional and multidimensional arrays are initialized with a one-dimensional sequence of constants listed separated by commas. The sequence is surrounded by curly braces. In this case I am confused by the word "constant". Can't a certain array index be assigned a value via a variable.

So you have to distinguish between: initialize and assign.
 
Vinin:
What if you set the line for yesterday or tomorrow?

Thank you for your attention, but I do not understand your question. The line can be set for any date, and when the chart reaches it, the EA will trigger? Or maybe I do not understand something, if you don't mind explaining it to me.