Download MetaTrader 5
To add comments, please log in or register
Publish your task in Freelance service and developers will execute your order.
Agent86
915
Agent86 2014.11.25 17:47  
WHRoeder:
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
/ /12
To add comments, please log in or register