Questions from a "dummy" - page 31

 
Interesting:
Not pinpointed, it will draw in normal mode if the values are correct. In render mode there will probably be problems with BMP-graphics (I'm 90% sure).
At the weekend I was fiddling with the objects. If everything is not specified explicitly and unambiguously, begins to stumble - no objects, and no errors.
 
Silent:

Initialisation - inside the function, values - from global? Hmm.

From the help, for comparison

You're taking very literally what's written in the help. )) Initialization within function for local variables. I, on the other hand, initialized them globally.
Документация по MQL5: Основы языка / Переменные / Локальные переменные
Документация по MQL5: Основы языка / Переменные / Локальные переменные
  • www.mql5.com
Основы языка / Переменные / Локальные переменные - Документация по MQL5
 
Silent:
I was fiddling with objects over the weekend. If you don't specify everything explicitly and unambiguously, it starts to stall - no objects, and no errors.
Did you manage to display BMP objects in visualization mode in the tester or not, I still don't understand? There is no problem with it outside the tester.
 
tol64:
You're taking what's written in the help very literally. )) Initialization within function for local variables. I initialized them globally.

I.e., global values are used when names match? Is that correct?

PS add a redraw at the end though.

 
tol64:
Did you manage to display BMP objects in the visualisation mode in the tester or not, I still don't understand? There is no problem with it outside the tester.
Answered above - haven't tried it, I'm not up to it yet. I just saw something in the code with which I didn't even draw objects, what bpm.
 
Silent:

I.e., global values are used when names match? Is that correct?

PS Add a redraw at the end though.

ChartRedraw(); set in correct places inside OnInit(), OnChartEvent() and OnTick() functions. I don't have any coincidence of names.))
 
Silent:
At the weekend I was fiddling just with objects. If everything is not specified explicitly and unambiguously, it starts to stall - no objects, and no errors.
The original question was not about the possibility to display graphical objects, but about the fact that in normal mode it happens, but not in visualization mode.
Silent:

Initialisation - inside the function, values - from global? Hmm.

From the help, by way of comparison

If you consider a function separately, it's just a function. Which, for example, can be stuffed into library and worked with from any place.

But the example from help shows rendering of object by script.

PS

As for the function itself, I think it lacks check of parameters for correctness (of course it is developer's personal opinion).

Also, I'd make type bool, not void (with error handling of object creation).

 
Interesting:

As for the function itself, in my opinion it lacks parameter checking for correctness of parameters (in principle, this is of course the developer's own business)

That's a good point. I'm just still in the process of studying mql4/mql5 and will improve the code as I go deeper into this environment)). Or until a rake hits me)).
 
tol64:
ChartRedraw(); set in the right places inside OnInit(), OnChartEvent() and OnTick() functions. I don't have any name matches.)

So no values are assigned either.

void Create_BMP_Label(long   chart_id,  // id графика
                      string bmp_nm,    // имя объекта
                      string bmp_path,  // путь к обекту
                      long   anchor,    // точка привязки инициализировали
                      long   corner,    // угол привязки
                      int    x_dist,    // координата по шкале X
                      int    y_dist)    // координата по шкале Y
  {
   ObjectCreate(chart_id,bmp_nm,OBJ_BITMAP_LABEL,0,0,0);          // создание объекта
   ObjectSetString(chart_id,bmp_nm,OBJPROP_BMPFILE,0,bmp_path);   // BMP файл
   ObjectSetInteger(chart_id,bmp_nm,OBJPROP_ANCHOR,anchor);       // установка точки привязки использовали, а где взяли значение?
   ObjectSetInteger(chart_id,bmp_nm,OBJPROP_CORNER,corner);       // установка угола привязки
   ObjectSetInteger(chart_id,bmp_nm,OBJPROP_XDISTANCE,x_dist);    // установка координаты X
   ObjectSetInteger(chart_id,bmp_nm,OBJPROP_YDISTANCE,y_dist);    // установка координаты Y
   ObjectSetInteger(chart_id,bmp_nm,OBJPROP_SELECTABLE,false);    // нельзя выделить объект, если FALSE
   ObjectSetString(chart_id,bmp_nm,OBJPROP_TOOLTIP,"\n");         // нет всплывающей подсказки, если "\n"
  }
 
Silent:

So no values are assigned either. Where did you get the value?

I pass these object properties explicitly (ANCHOR_RIGHT_UPPER, CORNER_RIGHT_UPPER):
Create_BMP_Label(0,TI_bmp_nm,TI_bmp_pth,ANCHOR_RIGHT_UPPER,CORNER_RIGHT_UPPER,x,y);
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Свойства объектов
Документация по MQL5: Стандартные константы, перечисления и структуры / Константы объектов / Свойства объектов
  • www.mql5.com
Стандартные константы, перечисления и структуры / Константы объектов / Свойства объектов - Документация по MQL5
Reason: