OrderSelect(i, SELECT_BY_POS, MODE_HISTORY)

 
Hey dudes,

I am trying to figure our whether MODE_HISTORY trades, when accessed by position, are sorted ascending (i.e. very first order is at position 0) or descending (last closed trade is at position 0).
From several posts on this forum it seems that first trade is at zero but if someone could confim that, please?
Yes I know I can easily test it but I am old, stupid and lazy :)

thanks in advance!

P.S. Rosh - I will provide EA sources in my post about the back-testing recalculation in a few moments. By the way - your English is fine, don't ya worry about that :). Also, by the way - I know Russian because my mother is russian :) I lived most of my life in Sofia, Bulgaria which is where my father is from, I live in Canada now. Here's my mail: { ilistentojack at shaw dot ca }, send me a quick note if it is ok with you so I habe your email? "Na vsiakii pojarnyi sluchai" :) I am not a spammer, I swear :)

P.P.S. By the way, guys, beware: somebody suggested in another post that it is a good idea to keep the last active trade ticket in a global variable so you have it handy when you need to close the position. Yes this does sound tempting, especially if you're writing an expert which only works with one trade at a time, however this is a VERY BAD IDEA.
Here's why: the server can close your trade due to stop loss or take profit and then your saved ticket is worthless. Another thing which can happen (and I figured his the hard way, because it was happening to me, because I was keeping my ticket in a global variable, hehe) - so what can happen is that at mid -night the server re-calculates the swaps on all open positions. This is done by closing the existing positions and re-opening them again with the balance being adjusted according to the swap rate. Naturally your order ticket chanegs at that time. In other words - don't try to "memorize" your tickets, always do a for(...; i<OrdersTotals();. ..) . Also - when closing positions loop backwards, because as soon as you close a order at position "i" - the next one takes its place in the ordered list and becomes the "i"-th position. Mean while you're happilly incrementing your counter, thus effectively skipping two orders on every iteration and possibly missing positions which may need to be closed. And if you saved your OrdersTotals() into a local variable and are checking "i" against it - well, then you're really screwed (and if you don't understand why then you probably should not be reading this).

Anyway - would somebody please answer my original question? See: I am lazy but not THAT lazy - after all I wrote a very long post here telling people about my experience so they don't do the same mistake :) There's so many new mistakes we can do every day, why bore ourselves with the known ones? ;)
 
There is no guaranteed order in OrderSelect()  function.
 
hmm.. then how can I test if my last N trades were winning or loosing? I was hoping I could loop forward or backwards through the completed orders and scan the profit? Are you saying I should manually sort the completed orders by closing time? That would be a pain... :(
 

Hmmm -- I can only assume you are right.

Is it true that "There is no guaranteed order in OrderSelect() function." with MODE_HISTORY and SELECT_BY_POS?

Reason: