Converting time / price to pixel coordinates on objects

 
I need someones help, because I am stuck since a few hours now with the following task:

A graphical object is attached to a chart - an arrow in this case. This object needs a time and a price as coordinate.
Now I wanna convert the time and price coordinate into a pixel based coordinate. Any idea how this can be achieved?

I was thinking about using WindowPriceMin / Max, WindowsFirstVisibleBar and WindowBarsPerChart, but don't know exactly how.
To help me with this problem, I also have written a DLL that gives me the width and height of the current chart window in pixels.

But still no idea how to solve it... maybe sitting too long in front of this. Any help appreciated :-)
 
 
Thank you for providing this link, but I can's see how to use this code. Can you give an example?
 
adamp wrote >>
I need someones help, because I am stuck since a few hours now with the following task:

A graphical object is attached to a chart - an arrow in this case. This object needs a time and a price as coordinate.
Now I wanna convert the time and price coordinate into a pixel based coordinate. Any idea how this can be achieved?

I was thinking about using WindowPriceMin / Max, WindowsFirstVisibleBar and WindowBarsPerChart, but don't know exactly how.
To help me with this problem, I also have written a DLL that gives me the width and height of the current chart window in pixels.

But still no idea how to solve it... maybe sitting too long in front of this. Any help appreciated :-)


"I also have written a DLL that gives me the width and height of the current chart window in pixels."

Really? Can you post the code in your DLL that got the width and height of the current chart in pixels? I've been trying to figure this EXACT problem out. I may be able to solve it if I can see how you got the chart size in pixels.

 
Ais wrote >>

A Sample: Chart metrics, https://www.mql5.com/en/forum/112633/page7#276861


Won't work. price/time isn't a 1:1 ratio (no matter how you divide it). Now, if your chart windows was a perfect square, that would work beautifully.
 
This library already helped me a lot. Now I know how many bars are left on the right hand side of the chart shift.
Together with the bars on the left, min and max price, I can calculate a good approximation of the position.

I am very excited how accurate this will be. But seems promising so far.
 
adamp wrote >>
This library already helped me a lot. Now I know how many bars are left on the right hand side of the chart shift.
Together with the bars on the left, min and max price, I can calculate a good approximation of the position.

I am very excited how accurate this will be. But seems promising so far.


Well, I found where to ge the height: https://www.mql5.com/en/code/9198
Reason: