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.
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.
Have the same problem. Came up with such solution:
1. Say my array is tickets[5,8], I am running this in loop, also using arraysize() functions, so i just need to empty it keeping the dimensions and size.
2. At the beginning of the script i initialize empty array:
string emptyTickets[5,8]
3.Each time i need to clear my array i just copy empty array to it:
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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.
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?
Seems like EMPTY_VALUE did the trick
Be careful with ArrayMaximum() as it can return EMPTY_VALUE. Have in mind that EMPTY_VALUE = 2147483647
Saidar wrote >>
. The array needs to be reset each time.
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.
Have the same problem. Came up with such solution:
1. Say my array is tickets[5,8], I am running this in loop, also using arraysize() functions, so i just need to empty it keeping the dimensions and size.
2. At the beginning of the script i initialize empty array:
string emptyTickets[5,8]
3.Each time i need to clear my array i just copy empty array to it:
ArrayCopy(tickets,emptyTickets,0,0,WHOLE_ARRAY);