IndicatorCounted().... bug?

 
I have Build 217 02/Jul/2008


int start()
   {
   counted_bars=IndicatorCounted();   
   if(counted_bars<0) return(-1);    
   if(counted_bars==0)
      {
      process history bars 
      }
    else
      {
      process bar 0
      }
    }


In the above code, randomly in long periods of time, the IndicatorCounted() function will return 0 counted bars after the history bars were processed.

Is this normal? or bug?

Is it necessary to process all chart bars as provided by Bars variable?

 
No, it isn't bug. IndicatorCounted() returns 0 (zero) in first indicator calculating and if available history is changed. Indicator must know that it's necessary to recalculate ones buffers for sufficient value.
 
No, it isn't bug. IndicatorCounted() returns 0 (zero) in first indicator calculating and if available history is changed. Indicator must know that it's necessary to recalculate ones buffers for sufficient value.


Rosh, my problem is that it appears that the indicator resets or restarts itself. When it happens I can see window cursor showing "time wait" icon. No crash message. I have never had this problem before. After this false restart, I have to manually reload the indicator because the window display gets destroyed.

Do you have any idea what may caused it.
I have read similar complaints at this forum in past.
 
One more time again: if history was changed by any reason the IndicatorCounted() function return 0 (zero). It's especial that you can recalculated you indicator if it is necessary. You can't get any window crash or destroy from this function.
 
One more time again: if history was changed by any reason the IndicatorCounted() function return 0 (zero). It's especial that you can recalculated you indicator if it is necessary. You can't get any window crash or destroy from this function.


I believe I have found the problem!

As always for some unknown reason the MT4 program gets corrupted over a period of time and will start reseting itself skipping init() function which will cause incomplete reset.

To reinstall MT4 into same directory will usually not fix the problem.

To fix this corrupted installation it is necessary to open new directory with NEW NAME reinstall MT4 and copy all indicators/scripts and experts into the new directory.

Although I am not sure I do attribute this corruption to a registry leakage since I can see unexplained migration of some data from one MT4 terminal into next one.
 
sub :
One more time again: if history was changed by any reason the IndicatorCounted() function return 0 (zero). It's especial that you can recalculated you indicator if it is necessary. You can't get any window crash or destroy from this function.


I believe I have found the problem!

As always for some unknown reason the MT4 program gets corrupted over a period of time and will start reseting itself skipping init() function which will cause incomplete reset.

To reinstall MT4 into same directory will usually not fix the problem.

To fix this corrupted installation it is necessary to open new directory with NEW NAME reinstall MT4 and copy all indicators/scripts and experts into the new directory.

Although I am not sure I do attribute this corruption to a registry leakage since I can see unexplained migration of some data from one MT4 terminal into next one.

Finally I believe I fix the problem!....... it was filthy cooling fan on the CPU.

Folks keep it clean.

 
That's a hot tip...
 

OK, none of the foregoing fixed the problem.

It looks like some memory problem.

I am using a 1M chart with lot of objects per bar and it seems to work a OK for about 4 days 24*60*60 = Bars 345600

I have set Max Bars 1024000 bars in the chart and same in the history to make sure that enough memory is allocated.

I have 1024 MB memory module in Windows XP


For some reason it appears that there is not enough memory or something is not properly set to allow my Trader 4 to take full advantage of it.

Is there any seating for memory allocation.


When I reach this 4 day condition the indicator would irregularly restart even from the Property window after hitting the OK button. It would take many attempts to restart corectly.


Slawa...... any suggestion?

I am going bananas.

Edited: I should add that the problem is not evident when market is closed over the weekend and there are no incoming ticks.
Since the indicator loading takes several minutes it appears that incoming ticks cause an internal crash...... is it possible Slawa?

So it appears that the common denominator is a loading time and incoming ticks rather than memory size and incoming tick.

 

sub, the following has helped me in big programs:

#property indicator_buffers 2 // up to 8

 
sx_ted :

sub, the following has helped me in big programs:

#property indicator_buffers 2 // up to 8

sx_ted, I am using all 8 buffers so my property setting must be:

#property indicator_buffers 8
Reason: