How can I get the grid in the chart

 

I have programmed an EA which shows a few optical objects in the chart (some short lines with text)

Now I want to change the length of lines with the zoom of the chart.

I would be great, if my length could always be like one box of the grid.

How can I do that?

 
Your lines end points are based on time and price. They will visually change length as you zoom the chart. Nothing needs to be done.
 
sunshineh:

I have programmed an EA which shows a few optical objects in the chart (some short lines with text)

Now I want to change the length of lines with the zoom of the chart.

I would be great, if my length could always be like one box of the grid.

How can I do that?

you mean -> on zoom-in line should get shorter and on zoom-out line should get longer..??
 

Yes, that's the point!

When I am in the most zoom out level, one box from the grid is about 32 bars and

in the most zoom in level one box is only one bar. I want to reach exactly this behaviour with my line.

How can I do this?

Reason: