Interesting: I don't understand it but the code seems fine at first glance. Maybe I'm blind, but where exactly are the errors?
In my post it is highlighted in red - there are no values for chart id, anchor point, anchor angle (what is it for, if we don't rotate the picture?), coordinates.
In my post in the code it is highlighted in red - there are no values for chart id, anchor point, anchor angle (what is it for, if we don't rotate the picture?), and coordinates.
And I thought I was the beginner)))) This is a function. Values are transferred to it.))
In my post, in the code marked red - no values for chart id, anchor point, anchor angle (what for, if you don't rotate the picture?), or coordinates.
1. About Id - there should be no values there (as I understand it is expected to be default 0), and what is written in the commentary is most likely "for yourself".
2. About Angles Binding - Binding goes to a particular corner of the graffiti (left-top, right-top, bottom-right and bottom-left). By specifying these parameters we determine what corner the object is anchored to.
This code will create a LABEL at the bottom-right corner
Not pincially, it will draw in normal mode if the values are correct. In render mode, there will probably be problems with BMP-graphics (I'm about 90% sure).
Initialization - inside the function, values - from global? Hmm.
From the help, for comparison
#define UP "\x0431"//+------------------------------------------------------------------+//| Script program start function |//+------------------------------------------------------------------+voidOnStart()
{
//---string label_name="my_OBJ_LABEL_object";
if(ObjectFind(0,label_name)<0)
{
Print("Object ",label_name," not found. Error code = ",GetLastError());
//--- создадим объект LabelObjectCreate(0,label_name,OBJ_LABEL,0,0,0);
//--- установим координату XObjectSetInteger(0,label_name,OBJPROP_XDISTANCE,200);
//--- установим координату YObjectSetInteger(0,label_name,OBJPROP_YDISTANCE,300);
//--- зададим цвет текстаObjectSetInteger(0,label_name,OBJPROP_COLOR,clrWhite);
//--- установим текст для объекта LabelObjectSetString(0,label_name,OBJPROP_TEXT,UP);
//--- установим шрифт надписиObjectSetString(0,label_name,OBJPROP_FONT,"Wingdings");
//--- установим размер шрифтаObjectSetInteger(0,label_name,OBJPROP_FONTSIZE,10);
//--- повернем на 45 градусов по часовой стрелкеObjectSetDouble(0,label_name,OBJPROP_ANGLE,-45);
//--- запретим выделение объекта мышкойObjectSetInteger(0,label_name,OBJPROP_SELECTABLE,false);
//--- отрисуем на графикеChartRedraw(0);
}
}
It is unclear why it works at all.
The correct example is at the bottom of the page
There is also a search first, and redrawing - I saw somewhere that it's better to be safeguarded.
// Don't beat me, I'm learning it myself.
Silent:
I have highlighted errors, because of which the code does not seem to work. Compare your code to the one in the sample by the link.
I don't understand it but the code seems fine at first glance.
Maybe I'm blind, but where exactly are the errors?
In my post it is highlighted in red - there are no values for chart id, anchor point, anchor angle (what is it for, if we don't rotate the picture?), coordinates.
In my post in the code it is highlighted in red - there are no values for chart id, anchor point, anchor angle (what is it for, if we don't rotate the picture?), and coordinates.
And I thought I was the most novice.)) It's a function. Values are passed into it.)
Where do the values come from?
From anywhere. External parameters, global variables, local variables. Or you can write values at once.
Example:
From anywhere. External parameters, global variables, local variables. Alternatively, values can be written in immediately.
In my post, in the code marked red - no values for chart id, anchor point, anchor angle (what for, if you don't rotate the picture?), or coordinates.
1. About Id - there should be no values there (as I understand it is expected to be default 0), and what is written in the commentary is most likely "for yourself".
2. About Angles Binding - Binding goes to a particular corner of the graffiti (left-top, right-top, bottom-right and bottom-left). By specifying these parameters we determine what corner the object is anchored to.
This code will create a LABEL at the bottom-right corner
And this one will display the same object but in the left-bottom corner
As many of you have already understood, only two lines have changed - these
In your code - where from?
In your code, from where?
From global variables (highlighted in red).
From global variables (highlighted in red).
Initialization - inside the function, values - from global? Hmm.
From the help, for comparison