string OrderArray[0][4];
- Don't declare the array a fixed size; that shouldn't even compile. use Array[][4].
- You don't resize the array before trying to insert into it, so of course you get out of range.
- You need to keep the array size separate from the variable i because you aren't storing all orders.
- You are storing different things, don't use a common datatype (strings) use a structure
struct Data{ int ticket, direction; double entryPrice, lots; datetime entryTime; } Data OrderArray[]; : ArrayResize(OrderArray, count+1); OrderArray[count].ticket = OrderTicket(); OrderArray[count].direction = OrderType(); OrderArray[count].entryPrice = OrderOpenPrice(); OrderArray[count].lots = OrderLots(); OrderArray[count].entryTime = OrderOpenTime(); ++count; // Now you have one.
Play videoPlease edit your post.
For large amounts of code, attach it.
- Don't declare the array a fixed size; that shouldn't even compile. use Array[][4].
- You don't resize the array before trying to insert into it, so of course you get out of range.
- You need to keep the array size separate from the variable i because you aren't storing all orders.
- You are storing different things, don't use a common datatype (strings) use a structure
Play videoPlease edit your post.
For large amounts of code, attach it.
Thanks.
1. Yeah, I don't know why I had 0 in the first dimension. It's not like that in my code, but was like that in the OP.
2. I'm guessing you mean I *didn't* resize the array before trying to insert into it?
3. Not sure about this one, I guess it will make sense once I work on #2.
4. Don't know anything about structure, I'll look at your code and look into it.
5. As I mentioned, the SRC button doesn't work for me. I tried 3 different browsers and nothing. What happens in your video doesn't happen for me. This will be the 2nd time I apologize.
edit: I decided to try one last time and now the SRC feature is working.
Hey, just wanted to say I looked at the code shortly afterwards and it worked out great. I understood everything you meant, WHRoeder. The struct class is very similar to object-oriented programming, which I remember from my Java course in college. This has been a great addition to my arsenal.
Once again, thank you very much!

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi, I'm trying to write an EA, first step is to compile a list of open orders that match the symbol that the EA is currently open on.
However, whenever I try to check the contents of an array index with
I get an Array out of Range error.
Here is the relevant code: