WHRoeder: As honest_knaveand I both tried to say, you are confusing the position numbers with the count.
OMG and then it hit me ! You know what ? I was actually only looking at the narrow view of the (for loop) without reference to using i as an index. (Dunce Cap On Now)
Given that OrdersTotal() and OrdersTotalHistory() are int. types; and at some point will likely use OrderSelect at some point in the loop; and hence -1 for OrderSelect(index, , ,)
That was my whole problem. I assumed we were NOT using an index. One posters indicated YES OrderTotal of 0 would be an order. This further confused me. They probably assumed index 0 when in fact OrdersTotal() 0 is not an order at all and is not an index at all.
I am so dense sometimes, I know arrays are simple enough, and -1 makes sense to convert a count to a index for use. I knew this too. But I really did not consider that this is actually what the loops was doing this for me to use OrderSelect(index, , , )
I totally forgot about the OrderSelect(i = index) I was only trying to figure out how OrdersTotal() - 1 would ever be able to use the last order number. HAHAHAH Now this is actually pretty darn funny now that I understand why I needed to convert this to an index.
hahahahah.
Thanks, I'll take my dunce cap now and go sit in the corner for a little while HA !
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
As honest_knave and I both tried to say, you are confusing the position numbers with the count.
OMG and then it hit me !
You know what ? I was actually only looking at the narrow view of the (for loop) without reference to using i as an index. (Dunce Cap On Now)
Given that OrdersTotal() and OrdersTotalHistory() are int. types; and at some point will likely use OrderSelect at some point in the loop; and hence -1 for OrderSelect(index, , ,)
That was my whole problem. I assumed we were NOT using an index.
One posters indicated YES OrderTotal of 0 would be an order. This further confused me. They probably assumed index 0 when in fact OrdersTotal() 0 is not an order at all and is not an index at all.
I am so dense sometimes, I know arrays are simple enough, and -1 makes sense to convert a count to a index for use. I knew this too.
But I really did not consider that this is actually what the loops was doing this for me to use OrderSelect(index, , , )
I totally forgot about the OrderSelect(i = index) I was only trying to figure out how OrdersTotal() - 1 would ever be able to use the last order number. HAHAHAH
Now this is actually pretty darn funny now that I understand why I needed to convert this to an index.
hahahahah.
Thanks,
I'll take my dunce cap now and go sit in the corner for a little while HA !
Thanks again