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

 
eevviill:

StringGetChar()

StringGetChar()

Or is it the wrong one?

no it's not ... the meaning of the decoding is this: each Russian letter has a value e.g. "a" which is a combination of \u0430

to convert you need to determine which letter has this or that value and then replace these values with letters ... It may be possible through KernelDll but it's a muddy path, at least it didn't work for me, not much information and it looks like it's not quite right ... but a custom function is the only easy way out in my opinion
 
Trader76:

I've been writing to replace short names for characters, break up the strings into letters, and do the replacement.

Thank you very much, I will do so.
 

Good afternoon. I have a small problem when using the indicator when switching to another timeframe, the terminal starts to slow down, and sometimes it hangs completely.

The indicator is the Bollinger Bands with the deviation value displayed. I don't know what exactly in the code is causing performance degradation.

Can anyone advise how such issues are solved in general, or where to start?

 
FiVik:

Good afternoon. I have a small problem when using the indicator when switching to another timeframe, the terminal starts to slow down, and sometimes it hangs completely.

The indicator is the Bollinger Bands with the deviation value displayed. I don't know what exactly in the code is causing performance degradation.

Can anyone advise how such issues are solved in general, or where to start?

Most likely there is a large period for the calculation, that's why it hangs, I don't think you need to count for 5000 bars in history to get the current values.
 

Trader76 here is the function that was added: iMAOnArray. In it, you need to specify the number of elements to calculate. I specified all elements of the array; this is the only way to obtain the correct value of the standard deviation mean.

I checked it by overlaying a moving average on the standard deviation indicator. If I specify a particular number of elements, the calculated value changes.

Perhaps, the indicator is slow because of calculating the entire array, but it does not calculate it correctly in other ways.

The period of calculated average is 30.

 
FiVik:

Trader76 here is the function that was added: iMAOnArray. In it, you need to specify the number of elements to calculate. I specified all elements of the array; this is the only way to obtain the correct value of the standard deviation mean.

I checked it by overlaying a moving average on the standard deviation indicator. If I specify a particular number of elements, the calculated value changes.

Perhaps, the indicator is slow because of calculating the entire array, but it does not calculate it correctly in other ways.

The period of calculated average is 30.

Show me the code
 

This is exactly what I added, before this the indicator was not slowing down.

//+------------------------------------------------------------------- 
//|Расчет среднего значения девиации
//+------------------------------------------------------------------- 
      Averagedeviation=iMAOnArray(deviationBuffer,0,30,0,MODE_SMA,i);
//+------------------------------------------------------------------- 
//|Вывод значения на экран отдельным объектом
//+------------------------------------------------------------------- 
      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;                            // Цвет для -
      
      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);// Текстовое описание объекта      
      i--;   
     }
//----------------------------------------------------------------------
   return(0);
  }
int deinit()
   {
   ObjectDelete(Obj_Name);                                      // Удаление объекта при выходе
   return(0);
   }
//+------------------------------------------------------------------+
 
FiVik:

This is exactly what I added, before this the indicator was not slowing down.

Well, if you don't want to do it, that's fine.
 
Vinin:
Well, if you don't want it, fine.

I don't understand. What do you mean you don't want to?

You want the whole code? Okay.

The name is in Cyrillic, that's why it's in hieroglyphics.

Files:
 
FiVik:

I don't understand. What do you mean you don't want to?

You want the whole code? Okay. (chuckles)

The name is in Cyrillic, that's why it's in hieroglyphics.

It was easier to redo the whole thing.

Files:
Reason: