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

 

Hello! I need help in redoing the code. The main part of the code is attached as a file. The code builds a table. I figured out how to insert my values into Content - table content, but unsuccessfully tried to do the same with font colour.

And so, you need to do a text colour control like done with Content:

   // Готовим массив с содержимым таблицы      
      for(int i=0;i<20;i++)
      {
       for(int j=0;j<2;j++)
       {
        Content[i][j]="Колонка "+(j+1)+", строка "+(i+1);
       }
      }

i.e. roughly like this:

aContentTextColor [i][j] // i, j номер колонки и строки - присваивать им цвет
Files:
1.mq4  8 kb
 
Kondratiev_A_A:

Hello! I need help in redoing the code. The main part of the code is attached as a file. The code builds a table. I figured out how to insert my values into Content - table content, but unsuccessfully tried to do the same with font colour.

And so, you need to do text colour control as done with Content:

i.e. something like this:

increase number of elements by "lines" (e.g. for(int j=0;j<4;j++) and in array declaration, too, accordingly ) and write in 2nd and 3rd (by numbers) elements colour codes in convenient for further interpretation

or for a colour you can define the second array of the same dimension, as for the content

 
smshev:

increase the number of elements per "line" ( for(int j=0;j<4;j++) and in the array declaration, too, respectively ) and write in the 2nd and 3rd (by number) elements the colour codes in a convenient form for further interpretation

or for the colour, you can create a second array of the same dimensions as for the content

Thanks for the reply!

Tried the second option with the addition of the array, but the other code is tied - tried to change the other code purely logically by analogy with the content - errors.

I don't understand it with the first variant, but I have a feeling it won't work - it won't be compact)

 
Kondratiev_A_A:

Thanks for the reply!

Tried the second option with the array addition, but the other code is tied - tried changing the other code purely logically by analogy with the content - errors.

I don't understand it with first variant, but I feel, that it will not work - it will not be compact)

Let me explain the first variant:

declare array not, for example, < string Content[100][2] >, but <string Content [100][3]>, in loop processing besides your string <Content[i][j]="Column "+(j+1)+", string "+(i+1);>

add < Content[i][j+1]="Green" > if you only need one colour per line. Or ="1", depending on how you decide to code colours there

 
smshev:

Let me explain the first option:

declare an array not, for example, < string Content[100][2] >, but <string Content [100][3]>, in the processing loop besides your string <Content[i][j]="Column "+(j+1)+", string "+(i+1);>

add < Content[i][j+1]="Green" > if you only need one colour per line. Or ="1", depending on how you decide to code colours there


I see what I mean now, thank you!
 
Lians:

atztek, so look at the code, if you know what the function code looks like and it's positioned like this:

ZS: if the function is in INIT() or DEINIT() you can try it without the code :)

Some operations that the function is allowed to do in deinit are not allowed in start, etc. (it is used several times in different parts of the code). Thought maybe there is a command that allows you to check.
And in general, it was solved by adding one more external variable to the list of function variables.

 
smshev:

Let me explain the first option:

declare an array not, for example, < string Content[100][2] >, but <string Content [100][3]>, in the processing loop besides your string <Content[i][j]="Column "+(j+1)+", string "+(i+1);>

add < Content[i][j+1]="Green" > if you only need one colour per line. Or ="1", depending on how you decide to code colours there


Unfortunately it was not clear to me, why change the number of columns from 2 to 3? And why assign a value (string value) to Green? It's not clear to me...
 
atztek:

Some operations that functions are allowed to perform in deinit are not allowed in start, etc. (it's used several times in different parts of the code). Thought maybe there's a command that lets you check.
And in general, it was solved by adding one more external variable to the list of function variables.

It's better to set a variable on a global level, to which the value should be assigned depending on which function the program is in. This eliminates the need to monitor the parameter passed to the user function, which is a potential source of errors.
 

Guys, please advise!

I need the program to keep SL in ten pips from the price and when closing at the level of SL, it will change the order to the opposite one. How this can be done?

 
alsu:
It is better to define a variable at global level, which can be assigned a value depending on which function the program is in. Then there is no need to keep track of the parameter passed into the user function, which is a potential source of errors.
True, but still you can make mistakes when assigning different values to a global variable;-)
Thank you!
Reason: