
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
First thing you must do is decide what your search value or index value is, versus what you are storing.
Ignoring bar index for now, your index value is swing and you are storing price. That would be a one-dimensional array, not two dimensions. You use swing index in and get price out.
In your case, you still use swing index in and get either bar or price out. Therefor, you need a two-dimensional array, not three. The first index is swing index, and the second selects price or bar index out.
I wouldn't use that, as you have two different data types. I would create a single dimension array of a structure of what you are actually storing.
Thanks for the suggestion. Looks like it will be a lot more efficient/easier than my own jungle of arrays.
First of all, apologies for the slow response. Work/life got in the way.
Also, just fyi, I believe you missed a semicolon in your code:
Now for the embarrassing bit. I've had to read up on structures as this is literally the first time I'm dealing with those.
I think(?) I understand them, but it may be the array part again that's throwing a spanner in the works.
How do I access the data in the structure?
When I look at this https://www.w3schools.com/cpp/cpp_structs.asp , by my reasoning it should be as simple as
or
But apparently it isn't. :)
Below is the code with my own comments and reasoning... (apologies if it's a tad messy)
Thanks again for any input.
It is that simple.
But your array is not a struct.It is that simple.
But your array is not a struct.at least I'm not crazy then and it would explain wording of the errors.
Would you care to elaborate on your second statement?
Does the highlighting help?
Does the highlighting help?
Only slightly... but my thinking is that I would have to declare the array would I not? whether I declare it as an int or double does not seem to make any difference.
Other than that I don't know what you mean. Sorry. :)
So I've cleaned things up a bit and tried some more.
where Print ends up spitting out the correct values because at this point it seems the array is valid and working.:
But... when I edit the print line as follows:
I get an " '[' - Array required " error.
I believe I can make the code work as is, but you've peaked my interest in this structure business. :)
It makes no difference because neither of those types are a struct. What part of “an array of a struct” was unclear? You already posted the correct code at #11.
Did I? uh oh... I'll have to check back then.
Probably some very annoying thing out of place.
Thanks for your assistance William. It's much appreciated and been a lot of help.
Gave me some new ideas
Thinking of actually doing a C++ course. Should help. :)