Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 1065

 

Alexey Viktorov:

Read the handbook carefully. OBJ_CHANNEL has nothing to do with the angle.

Got it!

Then back to the previous question:

There are X and Y coordinates, how to set a condition for ChartXYToTimePrice to count from the right corner?

 
MakarFX:

Got it!

Then back to the previous question:

There are X and Y coordinates, how do I set the condition for ChartXYToTimePrice to count from the right corner?

ChartXYToTimePrice counts the coordinates from the top left corner. And no matter how you calculate from the right-hand corner, you will always have to convert it to the top-left corner. What is the purpose of this tambourine? What object do you want to place relative to the right corner? Why don't you read the handbook? There are all the examples and explanations.

 
Alexey Viktorov:
What is the purpose of such a tambourine dance?

The left corner is busy(

Alexey Viktorov:

Why don't you read the handbook? After all, all the examples and explanations are there.

I've read and found examples, and the code is based on them,

but no examples of how to change the angle(

 
MakarFX:

The left corner is busy(

I've read and found examples, and the code is based on them,

but there are no examples of how to change the angle(

I guess I didn't look hard enough. Here are examples and all the explanations.
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Угол привязки
Документация по MQL5: Константы, перечисления и структуры / Константы объектов / Угол привязки
  • www.mql5.com
Существует ряд графических объектов, для которых можно задавать угол графика, относительно которого указываются координаты в пикселях. Это следующие типы объектов (в скобках указаны идентификаторы типа объекта): – объекты имеет ширину и высоту. Если указано "только для чтения", то это означает, что значения ширины и высоты вычисляются только...
 
MakarFX:

The left corner is busy(

I've read and found examples, and the code is based on them,

but there are no examples of how to change the angle(

It makes no difference from which angle the starting coordinate of the object is counted. This angle is the origin of the coordinates. Where the objects are located is up to you to calculate their coordinates from the origin.

 
Alexey Viktorov:
I must have looked too hard. Here are examples and all the explanations.

OBJ_CHANNEL requires time and price and XU can only be obtained with ChartXYToTimePrice

Artyom Trishkin:

It makes no difference from which corner the initial object coordinate is counted. This corner is the origin of coordinates. And where the objects will be is up to you to calculate their coordinates from the origin.

You can do it this way, but if the window size changes or the resolution is different on another computer, the object is shifted.

 
MakarFX:

OBJ_CHANNEL requires time and price and XU can only be obtained with ChartXYToTimePrice

This is possible, but if the window size changes or the resolution is different on another computer, the object is shifted.

You are talking in abstract terms. Take a screenshot of the screen - what you are placing there and why you see a problem. What is shifting where?

 
MakarFX:

OBJ_CHANNEL requires time and price and XU can only be obtained with ChartXYToTimePrice

This is possible, but if the window size changes or the resolution is different on another computer, the object is shifted.

Then look in the documentation for how to determine the DPI and use this to determine the width of the graph window.

 
Alexey Viktorov:

Then look in the documentation for how to determine the DPI and use this to determine the width of the graph window.

You got me right, I'll try to look it up. Thank you.
 
MakarFX:
You got me right, I'll try to look it up. Thank you.

Here is an example from the documentation.

//--- создаём кнопку шириной 1.5 дюйма на экране 
int screen_dpi = TerminalInfoInteger(TERMINAL_SCREEN_DPI); // получим DPI монитора пользователя 
int base_width = 144;                                      // базовая ширина в экранных точках для стандартных мониторов c DPI=96 
int width      = (button_width * screen_dpi) / 96;         // вычислим ширину кнопки для монитора пользователя (с учётом его DPI) 
... 
  
//--- вычисление коэффициента масштабирования в процентах 
int scale_factor=(TerminalInfoInteger(TERMINAL_SCREEN_DPI) * 100) / 96; 
//--- использование коэффициента масштабирования 
width=(base_width * scale_factor) / 100;
Reason: