Objects like Rectangle area disappearing when zooming in

 

Hi!

I'ld like to be able to draw some rectangles that are gonna mark support and resistances zones that may take lots of bars to be crossed, thus being relevant for a lot of time. In my tool, I do that by extending the final points of the rectangle to a whole new year in the future:

The problem is that sometimes the rectangle ends disappearing once I do some zoom in, in particular if the initial drawing is a little far away from current last bar. For example:

In this case, a filled rectangle was drawn some days ago. As I do a little zoom in, everything runs fine:

But if I zoom it a little bit more, it completely disappears:

If I use a lesser value, like to draw it only till the next month or a couple days from the current last bar, the problem continues. If the starting point of the rectangle is closer to the current last bar, I may need to do more zoom ins for it to disappear, but eventually it may happen as well. So it seems the Terminal is configured to automatically hide some drawn chart objects if they were placed somewhat far away from the current visualized bar eventhough, from the perspective of the user, those drawn objects are still relevant and it would like them to be still visible regardless of zoom level.

My question is: is there a way to change this behaviour?

 

Anchor point in the future is not reliable.

The only solution is to update it by code as new bars are created.

Or to use trend lines, with anchor point in present/past but with "ray" enabled.
 
Alain Verleyen #:

Anchor point in the future is not reliable.


How sad :( I suppose is some kind of bug then... Well, I tested here that if I put the future anchor point at the next day, the problem is apparently solved (two days and the bug already appears). So I guess what I could do is your suggested periodic update, but probably at OnInit with a run through the drawn Rectangles adding one more day.

Thanks for the answer!

 
Martin Bittencourt #:

How sad :( I suppose is some kind of bug then... Well, I tested here that if I put the future anchor point at the next day, the problem is apparently solved (two days and the bug already appears). So I guess what I could do is your suggested periodic update, but probably at OnInit with a run through the drawn Rectangles adding one more day.

Thanks for the answer!

Not a bug, it's how it was implemented. It's not that easy to have reliable anchor time in the future with charts having a non fixed number of bars.

I suppose MetaQuotes decided to not invest much time on that.

 

Programmatically, it is possible to draw into the future with indicator code. I have done this with vertical lines. There are free rectangle extenders that do that too. I can't link to one here due to Forum rules.

(This is the basis for any time-shifted moving average indicator.)