Refresh the chart window - page 3

 
Hey guys it is working fine. thanks again,,,
 
phy:

What is GV?

What I've been doing recently, is something like this:

for( int i = MathMax(WindowFirstVisibleBar(), Bars-IndicatorCounted()); i>= 0; i--){

It redraws the visible part of the indicator on every tick, but not the bars that are out of sight.

Hi, phy.....

Even i have the same problem as above, i have to change the time frame manually and then i get a refresh indicator status.....

As i am new to coding i dose'nt know where to to add the magic line................

for( int i = MathMax(WindowFirstVisibleBar(), Bars-IndicatorCounted()); i>= 0; i--){

Plesae suggest....

Thanks... a .....lot.

Harry.

 
brspMA:
Hey guys it is working fine. thanks again,,,

Hi, brspMA,

Even i have the same problem.........

Can u guide me where to add that lime...

Thanks......

 
  1. Why are you posting to a FIVE year old thread? Do you really expect someone who hasn't posted in years to reply?
  2. for( int i = MathMax(WindowFirstVisibleBar(), Bars-IndicatorCounted()); i>= 0; i--){
    You already drew all the bars so only bar zero is changing. What's the point of redrawing the visible bars
  3. A timeframe change, chart refresh, etc is already handled by IndicatorCounted, no additional code is needed, except the missing -1 -- left most bar is Bars-1
  4. hp69: Even i have the same problem.........
    If your indicator isn't updating without a refresh, the problem is your indicator is broken. Changing that loop will NOT help. You must fix the indicator. Only the first time (and refresh) will it draw all bars. Most other ticks Bars-1-IndicatorCounted() will be zero. The loop runs one time. You are using uninitialized variables instead of values saved in buffers, from the previous bar. If you can't figure it out, open a NEW post with your code.
  5. Hp69 Don't double post
 


Thread start date - 2007.11.29
 

WHRoederWhy are you posting to a FIVE year old thread?

RaptorUKThread start date - 2007.11.29

============================

What's wrong with replying to old threads?

Google doesn't discriminate content against chronology (unless using filters), so there's nothing wrong with helping others who come across threads via search engines.

Do mods go to a school where they're taught how to vilify and condemn noobs?

 
FlatFap:

WHRoederWhy are you posting to a FIVE year old thread?

RaptorUKThread start date - 2007.11.29

============================

What's wrong with replying to old threads?

Google doesn't discriminate content against chronology (unless using filters), so there's nothing wrong with helping others who come across threads via search engines.

Do mods go to a school where they're taught how to vilify and condemn noobs?

There is nothing wrong with replying to an old thread in principle.

It is replies like yours that have nothing to do with the topic that annoy others.

Also, replies to a 5 year old question are often not useful as mql4 evolves over time. Bringing an old thread to the top of the list will often mean that noobs are reading information that is no longer relevant.

 
FlatFap, you don't have to be disheartened. It's perfectly alright replying to an old thread. The very fact that Google put this thread on top of your search list means this is the closest possible match to what you are looking for. MQL4 is evolving just like any other application, but most command functions don't change everyday, and with a little bit of trial and error and further research, you may attain your desired solution. Good luck!
 

It is possible that we have to redraw an indicator, but we don't know how many bars we have to redraw. If we create a fractal indicator, we have to recalculate the last three bars, because the third bar may become a fractal if the next 2 bars on the left satisfy the rules. I've created an indicator which will mark a support or resistance level when it is broken. However this could append after 10 bars or after 1000 bars. So be don't really know how many bars we have to recalculate. And if we recalculate all the bars on each tick, we will usually need to limit our indicator to the last 500 or 1000 bars.

It is also possible to refresh the chart so that it will recalculate all the bars of our indicator. But how do we do it programmatically? WindowsRedraw() and ChartRedraw() won't trigger a refresh for the indicator. If we change the another time frame and come back, the indicator will be recalculated, as described in first post. We can put an Expert with a CHARTEVENT_CLICK handler in our chart and then call the method ChartSetSymbolPeriod(0, NULL, 0). This will set the chart to the actual symbol period and actually allow the indicator to be automatically recalculated each time we click on the chart. using a click event is only an example and you can use it the way you want.

 

At the end of indicator's code put "ChartNavigate(0,CHART_CURRENT_POS,0);"

{

...

ChartNavigate(0,CHART_CURRENT_POS,0);

   return(rates_total);

}

Reason: