Download MetaTrader 5

Clean up array, remove all data from array - page 2

To add comments, please log in or register
Kenneth Raymond Hubbard
Kenneth Raymond Hubbard 2010.05.13 13:41  

Why don't you ONLY write data to the array that you intend to use. Sounds like you are trying to force a square peg into a round hole. If there are more spaces in your array than you need to calculate for then I think you are using the wrong approach.

Try using an if loop to only place values in your array that are a valid part of the calulcation. Resize the array as required.

Franco 2010.05.13 21:04  

My problem is as follows:

I have array in loop

In each loop different numbers of entries are written to the array. The array needs to be reset each time.

I use ArrayMinimum a lot, meaning if I make all the array entries 0, or resizing the array that causes the entries to have a value of 0, the arrayminimum keeps giving me an answer of 0, because 0 is the minimum in the array.

How to I get past this?

Franco 2010.05.13 21:11  
Seems like EMPTY_VALUE did the trick
Nikolay Panev
Nikolay Panev 2010.05.14 09:37  
Seems like EMPTY_VALUE did the trick

Be careful with ArrayMaximum() as it can return EMPTY_VALUE. Have in mind that EMPTY_VALUE = 2147483647

whroeder1 2010.05.19 23:01  

Saidar wrote >>

. The array needs to be reset each time.

No it does not. Don't look at elements outside of the current count. Put in 5 only look at 0-4
Luis 2014.10.28 18:40  

Yes I have the same problem here:

I have this array= double matrix [][2];

that I do a lot of operations with in a loop, I need to "restart" it fresh for the beggining of the loop again.

To add comments, please log in or register