Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 1019

 
Vinin:

It was easier to redo the whole thing

Thank you very much for fixing the indicator, but I would like to know what was the reason of slow work of my code?

I don't think I will always be corrected in this way. Besides, I have to study somehow, and you cannot be sure that no error will occur again if you don't know it.

 
FiVik:

Thank you very much for fixing the indicator, but I would like to know what was the reason for my code being slow?

I don't think I will always be corrected in this way. Besides, I have to learn somehow, and if you don't know about errors, you cannot be sure that they won't occur again.

The main error is working with the graphics (object) in the loop. Although only the last calculated value was needed.

The first developer obviously was not aware of the standard functions and implemented his own. There is nothing bad in this, but nothing good either.

 
Vinin:

It was easier to redo the whole thing

Why simpler, just two rearrangements.

Just

if(i==0)
{
   string Text =DoubleToStr(deviation,4);                   // Текст для отображения с указанием количества знаков ппосле запятой
      if(deviation<=(Averagedeviation*1.1)&&deviation>=(Averagedeviation*0.9))// Выбор цвета зависит от динамики
      Color_Day_Percent = Color_0;                             // Цвет для 0
      if(deviation>Averagedeviation*1.1)                       // Выбор цвета зависит от динамики
      Color_Day_Percent = Color_Up;                            // Цвет для +
      if(deviation<Averagedeviation*0.9)                       // Выбор цвета зависит от динамики
      Color_Day_Percent = Color_Dn; 
}

+

    
      i--;   
     }
   if(ObjectFind(Obj_Name)==-1)                             // Если объекта нет..
      {
      ObjectCreate(Obj_Name,OBJ_LABEL,0,0,0);                  // Создаём новый объект 
      ObjectSet    (Obj_Name,OBJPROP_CORNER,    1);            // Угол привязки            
      ObjectSet    (Obj_Name,OBJPROP_XDISTANCE,15);            // Координата Х
      ObjectSet    (Obj_Name,OBJPROP_YDISTANCE,15);            // Координата Y
      }
      ObjectSetText(Obj_Name,Text,10,"MS Sans Serif",Color_Day_Percent);// Текстовое описание объекта  
 
eevviill:

Why simpler. just two permutations.

Just

+

My conscience doesn't allow me to give away bad code.

 
Vinin:

My conscience doesn't allow me to give away bad code.

What's so bad about it?
 

Good afternoon. Faced with a problem. Need a dynamic naming which was not repeated. Below is an example how, I have done but the problem is that in one tick may need several names. What is your advice?

string name=DoubleToStr(TimeCurrent(), 0);
 
abeiks:

Good afternoon. Faced with a problem. Need a dynamic naming which was not repeated. Below is an example how, I have done but the problem is that in one tick may need several names. What do you advise?

TimeCurrent()+GetMicrosecondCount()

or

int counter=1;

TimeCurrent()+=counter;

 
eevviill:

TimeCurrent()+GetMicrosecondCount()

or

int counter=1;

TimeCurrent()+=counter;

And the other solution? I work with fractals and there the M1, M5, M15 can be matched in time.

void OnTick(){
string name=DoubleToStr(TimeCurrent(), 0);
SetArrow(6, Red, name, FrakTime_M1, FrakPrice_M1, 3);
SetArrow(6, Yellow, name, FrakTime_M5, FrakPrice_M5, 3);
...
}
 
abeiks:

What about another solution? I work with fractals and there the M1, M5, M15 can overlap in time.

Time[0]+Volume[0]
 

please advise :

I need to edit information in a binary file (there are html tags and text inside)

what is the correct way ?
1 open the file for reading, read text into an array char one character at a time or into an array string with words edit the array open the file for writing pour it back into the file

2 can you edit in the file?

ps what is the easiest and most correct path to take when editing text within a file ?

Reason: