As far as I understand, we are talking about a two-dimensional array, in order to find the value in the second dimension by the value of the first dimension. But how do you write the data into an array beforehand?
KONDOR: specifically in this case you can create two arrays, a[1000] and b[1000].
And if the value you're looking for is at the very end of the array, you get a rather slow variant, because you have to look through all the values (up to break). The task is to find it quickly, spending no more time than it normally takes for a standard calculation (e.g. multiplying two variables of type double).
Suppose that the value we are looking for is in the last line of the switch function. I don't know the methodology of switch function, but somehow it seems to me that it will be not much different from the variant with the for () loop in terms of speed.
There is a TimeCurrent() function that turns the current time into seconds since 1970. Is there a function that turns these seconds (int) back into datetime. Or you may need to separate seconds, minutes, hours...? Thank you.
Colleagues, please advise what and where to change in the EA code to work in a brokerage company with five-digit quotes.
Array.
specifically in this case you can create two arrays, a[1000] and b[1000].
There is a switch function for "fast".
It won't make a difference, of course. On the other hand, it's not always going to be the last element.
And why do you care so much about the speed? Are you going to do this calculation on every tick?
It won't make a difference, of course. On the other hand, it's not always going to be the last element.
And why do you care so much about the speed? Are you going to do this calculation on every tick?
And don't worry, it will take a thousandth of a second to find the right value.