Refresh the chart window - page 2

 

The "problem" may be that the indicators use a limit, i.e. the IndicatorCounted() function
in order to not repaint bars.

Changing timeframe resets that, WindowRedraw() may not. Its function is to redraw objects, not indicator indexes.

void WindowRedraw( )
Redraws the current chart forcedly. It is normally used after the objects properties have been changed.

I know I usually go ahead and recalculate 1000 bars or so on most of the things I write, and that is
kicked off by a right-click Refresh.

If you don't severely limit the loop for the indicator, you get an indicator refresh on every tick.

 
? some have some clue of what is going on? Why I don't see any effect after using WindowRedraw()?

Thanks a lot,
 

Are you "hard of reading" ?

 
hi phy,

just after almost two months I got your last reply. I just don't know how I skipped that. I am still having trouble with "redrawing my indicator". now I will try to fix the issue with the information you gave me. thank you a lot,,,
 

Show your code...

 
brspMA:
hi phy,

just after almost two months I got your last reply. I just don't know how I skipped that. I am still having trouble with "redrawing my indicator". now I will try to fix the issue with the information you gave me. thank you a lot,,,
I read this thread and I think that there is an issue in your code => the WindowRefresh() function will not help you.
 
hi,

I guess I am trying to reset the indicator to force it to redraw all again from the beginning!? my issue is that I am using a function that changes the past data in function of the new data, and the result is that my chart becomes a mass over the time. I need to redraw my entire indicator periodically. lately, I've been changing the time frame, so that when I go back to the time frame I was, I get my chart windows clean (redrawn) . here is the schema of my code:

int start(){
   int limit;
   int counted_bars=IndicatorCounted();
   //---- check for possible errors
   if(counted_bars<0) return(-1);
   //---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
   if (limit>GV) limit = GV;
   //---- main loop
   for(int i=limit; i>=1; i--){
 
 
{calculates the variable and feed the buffers}
 
return(0);}
thanks a lot,,,
 
insert 2 lines into your code

int start(){
   int limit;
   int counted_bars=IndicatorCounted();
   //---- check for possible errors
   if(counted_bars<0) return(-1);
   //---- last counted bar will be recounted
   if(counted_bars>0) counted_bars--;
   limit=Bars-counted_bars;
 
   double startTime=GetTickCount();
   if (limit>GV) limit = GV;
   //---- main loop
   for(int i=limit; i>=1; i--){
 
 
{calculates the variable and feed the buffers}
 
   double finishTime=GetTickCount();
   Print("Calculation time is ",(finishTime-startTime)/1000.0," seconds");
return(0);}
 

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.

 
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.


GV is a global variable I use to set the limit according to how long back I want to back testing.

you guys are awesome!! I will implement this code this afternoon.

for( int i = MathMax(WindowFirstVisibleBar(), Bars-IndicatorCounted()); i>= 0; i--){
thanks for your generosity,,,
Reason: