You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi all,
Just to seek for a clarification on how arraybsearch works
In the event that a searched value is not found, Is it meant to return a nearest found value or does it return the nearest found value that is less in value than the searched value?
Did you read the documentation?
Yes i read. It says '... If the wanted value isn't found, the function returns the index of an element nearest in value.' This is what i'm trying to achieve in the code below
In the code, array arr[] stores fractal values. Assuming two of the fractal values in the array are 1.12345 and 1.11234, and the value i am searching for is 1.12344, the function returns the lesser value of 1.11234 which is not accurate, instead of the value that is closer, which is 1.12345
Why is it so?
Yes i read. It says '... If the wanted value isn't found, the function returns the index of an element nearest in value.' This is what i'm trying to achieve in the code below
In the code, array arr[] stores fractal values. Assuming two of the fractal values in the array are 1.12345 and 1.11234, and the value i am searching for is 1.12344, the function returns the lesser value of 1.11234 which is not accurate, instead of the value that is closer, which is 1.12345
Why is it so?
Ok, I see what you're saying now... it should say, "returns a value that's less than or equal to". If you want the closest value then you'll need a custom solution. Here is an example script with two different options. Personally, I would use the class derived from CArrayDouble over using c-style arrays since it is much safer and requires less hassles.
This is how class DoubleArray would be implemented:
Ok, I see what you're saying now... it should say, "returns a value that's less than or equal to". If you want the closest value then you'll need a custom solution. Here is an example script with two different options. Personally, I would use the class derived from CArrayDouble over using c-style arrays since it is much safer and requires less hassles.
This is how class DoubleArray would be implemented:
Thank you nicholishen. With you i always learn a lot.