
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 @Alain Verleyen,
I changed the method getPrice(), insted using CopyClose() I'm using CopyBuffer(). This doesn't change the main objective.
So, if I use "const" keyword in the method getPrice(), a get the error: "'CopyBuffer' - no one of the overloads can be applied to the function call". I think this occurs because CopyBuffer is not a const method, and is not possible call non const method inside a const method.
Aparently, I solved the problema using the operator "&" in the function Compare() to get the value of "this":
Finally I got the value I was expecting.
You can drop thisObject and replace it by "this" in the comparison.
But, why dont you use the "operator" functionality instead of a function "Compare"? Makes the code easier to read later.
You can drop thisObject and replace it by "this" in the comparison.
But, why dont you use the "operator" functionality instead of a function "Compare"? Makes the code easier to read later.
Because it's a polymorphic method of the base class CObject and it has to be overridden in order to implement sorting and searching in the Collection classes, CArrayObj and CList.
Aparently, I solved the problema using the operator "&" in the function Compare() to get the value of "this":
Finally I got the value I was expecting.
I'm not sure what you hope to achieve with this logic. Typically you would want to only compare the same elements for sorting and searching.
I'm not sure what you hope to achieve with this logic. Typically you would want to only compare the same elements for sorting and searching.
Exactly, now it is sorting, before that I could not make the comparison, I was getting erros and errors and errors. Now it's working.
This approach is not obvious and is not in any document, I had to do a lot of tests and "trial and error" until to get this. I hope others can enjoy the solution.
Exactly, now it is sorting, before that I could not make the comparison, I was getting erros and errors and errors. Now it's working.
This approach is not obvious and is not in any document, I had to do a lot of tests and "trial and error" until to get this. I hope others can enjoy the solution.
I am just curious why you needed the operator "&" in the function Compare() to get the value of "this".
I am just curious why you needed the operator "&" in the function Compare() to get the value of "this".
It's the equivalent of using GetPointer(this)
Well, that does not answer the question "why". There was no reason to reveal the pointer to self.
Well, that does not answer the question "why". There was no reason to reveal the pointer to self.