I did a search for refresh and redraw and did not find what I need, so apologies if it is somewhere and my searching ability sucks.
I have some horizontal line objects on my chart in metatrader. Lines for the high and low of the previous D1, H4, H1. The problem is that they are drawn dependent on the TF I am looking at when I add the indicator and then they stick there. So when a new bar comes in on say, H1, the line is now based on two bars back instead of the previous
Does anyone know how to redraw these programmatically as bars come in or when I change TF? Basically I want a refresh of the objects whenever new data arrives. I tried a while(true) loop but that just got metatrader stuck in an infinite loop.
Not sure if this is what you mean, or how much programming you’re capable of, but to change the parameter values of an existing object, it’s needs to be found by it’s name, and then whatever value you want can be changed . Are the horizontal lines named? Once you know that, then you can use the [B]ObjectFind()[/B] command, which you can use as a test to know whether to create the object in the first place, or update an existing one.
Creating an expert advisor does the job I need. I don’t just need to find the objects. I need them to refresh as more data comes in and move the labels accordingly.
I am attaching the EA for any who might want to use it. The included TFs are D1, H4, and H1. Just change the extension back to .mq4