Errors, bugs, questions - page 930

 
kPVT
Thanks for the tip.
Please share your experiences. Specifically:
1. Mechanism for generating unique names. Direct enumeration of existing names by auto-increment?
2. Mechanism for checking object authenticity. I.e. not just check if there is an object with such name, but all its parameters, e.g. sizes, types, text, etc. With resource saving in mind. It's rather labor-intensive to perform a colossal number of checks for each property of each object on each tick. Of course, if there was either blocking of object from any changes from outside (except for EA creator), or calculation of object hash to FAST (in one "if") check object for authenticity.
 

Please confirm the reproduction of the situation with the lack of chart redraw.

Attached is a simple expert. Conditions:

1. From 2013.01.07 to 2013.02.11. Most likely not affected.

2. testing in visual mode.

3. At the first run, slow down the speed to a minimum:

4. On the next run after initialisation press F12 (generate one tick).

Another very important condition is that the terminal must be running in offline mode. For clean experiment try to disconnect computer from network (disconnect all network adapters).

Observe.

1. Late display of the spread values on the chart.

ChartRedraw function working incorrectly or have I done something wrong? If you move the chart with the mouse (move it horizontally (time), it is redrawn correctly.

Files:
1.mq5  4 kb
 
voix_kas:
kPVT
Thanks for the tip.
Please share your experience. Specifically:
1. Mechanism for generating unique names. Direct enumeration of existing names by auto-increment?
2. Mechanism for checking object authenticity. I.e. not just check if there is an object with this name, but all its parameters, e.g. sizes, types, text, etc. With resource saving in mind. It's rather labor-intensive to perform a colossal number of checks for each property of each object on each tick. Of course, if there was either locking of object from any changes from outside (except advisor-creator), or calculation of object hash to check object for authenticity FAST (in one "if").

Without claiming to be true or optimal.

1.you can use standard library which uses random number + name for object name, e.g: 18467RadioGroupItem0Button, 06334ClientBack. And you don't need to delete objects yourself.

I haven't really made friends with the standard biblio yet and I'm doing it this way, haven't had any problems.

int nOBJ=0;//счетчик однотипных объектов
int OnInit()
  {
   //уникальное имя на основе текущего времени в момент инициализации (в 36 системе для краткости, пример: MI7E9G)
   basedName=ULongTo36Base(TimeLocal());
   leftName="LeftBorder "+basedName;//имя для единичного объекта
   ObjectCreate(0,leftName,OBJ_VLINE,0,time,0);
   for(nOBJ=1;nOBJ<=100;nOBJ++)//создание 100 однотипных объектов
    ObjectCreate(0,(string)nOBJ+basedName,OBJ_TREND,0,time,price);
   return(0);
  }
void OnDeinit(const int reason)
  {
   for(int del=1; del<=nOBJ; del++)
      ObjectDelete(0,(string)del+basedName);
   ObjectDelete(0,leftName);
   return;
  }

Here the discreteness will be 1 second. If you add several identical indicators from the template, the collisions will occur. In this case, you may add indicator parameters to basedName, or maybe milliseconds to TimeLocal(), random number or something else. In general, there are variants.

2. object authenticity - its unique name. Two objects, even of different types with the same name, cannot be in one chart window. Why should you check all the object's properties? Explain.

Do you want to check the manual modification of the object properties? There is theCHARTEVENT_OBJECT_CHANGE event.

To control accidental deletion, when you access an object, you need to check its existence and restore it if necessary (by the way, there is an object deletion event - I don't use it).


If you still want to use Comment to output formatted information, you can, for example, specify the required length of the string and, knowing this length, insert the description and parameter value (defining their lengths) in the right places.

Документация по MQL5: Основы языка / Функции / Функции обработки событий
Документация по MQL5: Основы языка / Функции / Функции обработки событий
  • www.mql5.com
Основы языка / Функции / Функции обработки событий - Документация по MQL5
 
voix_kas:
kPVT
Thanks for the tip.
Please share your experiences. Specifically:
1. Mechanism for generating unique names. Direct enumeration of existing names by auto-increment?
2. Mechanism for checking object authenticity. I.e. not just check if there is an object with such name, but all its parameters, e.g. sizes, types, text, etc. With resource saving in mind. It's rather labor-intensive to perform a colossal number of checks for each property of each object on each tick. Of course, if there was either locking of object from any changes from outside (except creator EA), or calculation of object hash to FAST (in one "if") check object for authenticity.
Maybe this would help: Look at the market through ready-made classes
 

kPVT

Thanks for the tip. I will try to use CHARTEVENT_OBJECT_CHANGE to control it.

Dima_S

Thank you. But I don't see the need in using standard classes.

Very kindly, please test the ChartRedraw function using a simple ready-made Expert Advisor in my previous post. Unfortunately, for some reason it gives one tick late. I.e. in the example it shows that the value of spread is shown for the previous tick, while the processing and output is at the current tick.

 
voix_kas:

kPVT

Thanks for the tip. I will try to use CHARTEVENT_OBJECT_CHANGE to control it.

Dima_S

Thank you. But I don't see the need in using standard classes.

Very kindly, please test the ChartRedraw function using a simple ready-made Expert Advisor in my previous post. Unfortunately, for some reason it gives one tick late. I.e. in the example it shows that the value of spread is shown for the previous tick, while the processing and output is at the current tick.

You're welcome. If you had read the article, you would have found the answers to the two questions))
 

Large programmes cannot be downloaded and installed from the Market. Pay close attention. The reason is unknown.

There may be some restrictions. There is no official information about them.

 

Can you give me a hint?

1. an indicator called from resources cannot receive input parameters?
2. If not, is there a possibility and how to bypass this (with crutches)?
 

It can. It's the same as iCustom().

handle=iCustom(_Symbol,_Period,"::Indicators\\Examples\\ZigZag.EX5",12,5,3);
 
Karlson:

It can. It's the same as iCustom().

Exactly, it can. Made a mistake in the code.

Thank you.

Reason: