Is this a bug in the automatic resizing of inidactor arrays?

 

I put a test case in the attachment for a problem I ran into recently.

In order to reproduce what I think is a bug, please try the following

steps:

1) Compile the test case and put it on a plot, say EURUSD M1.

2) Turn off "Auto Scroll"

3) Using the "Home" and "End" keys, verify that you can jump

to either end of the plot on the screen. Don't use any other keys

just yet.

4) Press the "Home" key to go to the beginning of the plot. Try

to visually memorize the bars of this custom indicator.

5) Press the "Left Arrow" or "Page Up" key ONCE. This will make

the plot shift to the right and fill in the left portion of the plot with

some more (older) data from the server. Look at the bars of this

custom indicator carefully. The bars of this indicator under the

newly downloded data don't match the data, in fact they remain

the same as they were before for the number of bars that were

just added.

6) Now, comment out the following line:

MaxIndex = ArrayMinimum(Output,WHOLE_ARRAY,1);
and repeat the same experiment again. This time the bars of the

indicator will display the correct values in step #5.

7) The same problem exists when the last two "Comment" statements

are used with the more complicated expressions in them.

Not knowing the intimate details of the internals of MT4 I can only

guess, but it seems that when the additional data is added to the

plot the arrays need to be resized, and during this step MT4 doesn't

operate correctly when shuffling the existing data in the old array

around. The weird thing is that even if I just plot Output[i] = High[i]

or something really simple with the indicator, the values are still

repeated the same way for the newly added portion of the indicator

output, while the bars in the main display don't do this.

Has anyone seen this? Am I doing something wrong? Is this a bug,

and if so, is there a workaround for this? I am using version 4.00,

Build 220. Is there a newer version that may not have this problem

any more?

Thanks for any comments on this in advance.

Arpad

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

Files:
Reason: