alyehoud: I have read and tried every forum post about refreshing/updating charts on new bar. I can't get any of them to work, even those that seem to be working for others. For example the following two versions of the same one, both placed within start(). What am I doing wrong?! |
|
alyehoud: I have read and tried every forum post about refreshing/updating charts on new bar. I can't get any of them to work, even those that seem to be working for others. For example the following two versions of the same one, both placed within start(). What am I doing wrong?!
|
|
WHRoeder, I think you may have written that code actually. I read quite a few of yours posts on the topic.
Referring to your points:
1. correct, it should be detecting the new bar, and then running WindowRedraw(); but it's not redrawing - I tried it on the M1 chart by changing all variables (and left it overnight and no changes even still). It's simply just not updating, unless I manually do it.
2. By 'delete the code', are you saying that it the whole thing is redundant and unnecessary (because it's not updating without the code, either)?
alyehoud: WHRoeder, I think you may have written that code actually .. but it's not redrawing - ObjectCreate(ChartID(),h4ShortE,OBJ_HLINE,0,0, h4Short); ObjectSetInteger(ChartID(),h4ShortE,OBJPROP_COLOR,clrBlue); ObjectSetInteger(ChartID(),h4ShortE,OBJPROP_STYLE,STYLE_SOLID); ObjectSetInteger(ChartID(),h4ShortE,OBJPROP_WIDTH,1); ChartRedraw(0); //WindowRedraw(); also tried |
|
alyehoud: WHRoeder, I think you may have written that code actually .. but it's not redrawing - |
|
I don't believe its redrawing because after it draws the initial lines, as the variable changes, the lines are static. It's not until I manually do it (change time frame and back) that it corrects. Hline is showing fine at time zero?
See this:
alyehoud: I don't believe its redrawing
| Now you mention redrawing. That not the same as not drawing. It is drawing and refresh is irrelevant. Do #4 and you will find your answer. |
I have read and tried every forum post about refreshing/updating charts on new bar. I can't get any of them to work, even those that seem to be working for others. For example the following two versions of the same one, both placed within start(). What am I doing wrong?!
Edit: I also tried it inline (example 3) to no avail...
Your problem is twofold
- You are wrongly assuming the new bar detection code doesn't work because the object didn't move.
- You are wrongly assuming the object will move when you redraw the chart because you used a variable h4short as a price coordinate.
The object with that name is created once, it doesn't matter how much you redraw the chart, ObjectCreate won't create the same object a second time unless you delete it.
If you want the object to move you should change the object's relevent coordinate parameter.
Use either ObjectSetDouble() with OBJPROP_PRICE or ObjectSet() with OBJPROP_PRICE1 to change the object's price coordinate.
Hello there, i think i have a problem relative to this Refreshing problem
The indicator i've coded should show arrows when crosses happens, but, unfortunately, it only show when i toggle timeframe (lige going to M5 and come back to the first timeframe)
I tried to use chartredraw and windowredraw but nothing happens. It still "lag"
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have read and tried every forum post about refreshing/updating charts on new bar. I can't get any of them to work, even those that seem to be working for others. For example the following two versions of the same one, both placed within start(). What am I doing wrong?!
Edit: I also tried it inline (example 3) to no avail...