And i just realized at the moment and i can not figured out what kind of sort is used in the OrdersTotal().... :((
Some idea?
The old documentation never said there was an order and neither does the updated documentation
bool OrderSelect( | int index, int select, int pool=MODE_TRADES) |
The pool parameter is ignored if the order is selected by the ticket number. The ticket number is a unique order identifier. To find out from what list the order has been selected, its close time must be analyzed. If the order close time equals to 0, the order is open or pending and taken from the terminal open positions list. One can distinguish an open position from a pending order by the order type. If the order close time does not equal to 0, the order is a closed order or a deleted pending order and was selected from the terminal history. They also differ from each other by their order types.
It was mostly by OrderCloseTime but not guaranteed: "zzuegg says history ordering "is not reliable (as said in the doc)" [not in doc] dabbler says "the order of entries is mysterious (by actual test)"
If you wanted a specific order you need to sort it. Could EA Really Live By Order_History Alone? - MQL4 forum
The documentation never said but in older version i could exactly define it. At my brokers it was allways sorted by ticket both the history and open orders.
But in the new MQL4 the open orders can not be defined, the history is sorted by close time from about 700 history data...
Is it possible the fresher position get lower ticket number than an older??? I hope it cant!
Do you think a developer of MetaQutes could answer what is the procedure of storage the OrdersHistory data?
Or it is absolute the broker's job?
Because the sorting procedure that you use too very slow down the time of runing EAs even if i use it only when history data changed :(
And i dont know this change was purposive or just really an BUG.
Because if this is just a bug i will not rewrite my identification procedure of my EAs...
Or do i have to use some external databes manager to solve this problem?
the history is sorted by close time from
I just checked it out, and its sorted (on my terminal) exactly the way I sort it. i.e. if i clicked on "Symbol" (to sort it by symbol) it stays that way until i change it
so, it's not reliable
Is it possible the fresher position get lower ticket number than an older??? I hope it cant!
no, but you can loop through all the orders and find the one you looking for
Do you think a developer of MetaQutes could answer what is the procedure of storage the OrdersHistory data?
of course the question is whether you will get an answer
Or it is absolute the broker's job?
I guess it's not related to the broker
Because the sorting procedure that you use too very slow down the time of runing EAs even if i use it only when history data changed :(
i think you have to debug your code (or change it) it doesn't supposed to take more than a few seconds
And i dont know this change was purposive or just really an BUG.
what difference does it make ?
Because if this is just a bug i will not rewrite my identification procedure of my EAs...
you have been told already it's not reliable
Or do i have to use some external databes manager to solve this problem?
no need an external database, you can do it with a simple code
The documentation never said but in older version i could exactly define it. At my brokers it was allways sorted by ticket both the history and open orders.
Orders history has NEVER been sorted by ticket number. It may have appeared to be that way if the orders were closed sequentially.
The orders history has no guarenteed order, but for the most part it was sorted by time of entry into the history pool.
If you write code based on what appears to be the case, but is not documented to be the case, you risk your logic being disrupted by updates and changes to the platform or the language.
Which broker do you use? Cause i tried this at 3 brokers (DirectFx, XM, Exness) and this was not true! Above built 600 this was always the close time...
Few seconds??? lool Every tick will be 1-2 sec???? pf...
Orders history has NEVER been sorted by ticket number. It may have appeared to be that way if the orders were closed sequentially.
The orders history has no guarenteed order, but for the most part it was sorted by time of entry into the history pool.
If you write code based on what appears to be the case, but is not documented to be the case, you risk your logic being disrupted by updates and changes to the platform or the language.
It is very interesting!
My EAs ran 1.5 years over by using like ticket sorted and had never problem, but since about 1 month has always problem to identify older positions both in history in open orders when i recognized this method changed :(
Thank you guys!
just for the fun of it i just dealt with 1741 orders in the history, it took exactly 7 seconds
So, for 7 sec your EA can not do nothing else and does not know other data...and this repeats in every tick... It is not proper for my startegy... I have to find some other solution...
Just you know the order selection takes more time than get information from the selected order (eg. OrderTicket(), OrderOpenTime()..)

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
More than 30 of my EAs stopped to work correctly on my live account after upgrade to 6xx build.
I figured out that the sorting of order history was changed.
In older version the sort was by orders ticket and in the newer version it is sorted by close time.
I could not find any note or description about this change.
Why i could not?
Is it pemanent change or jut some other bug?
So do i have to rewrite my EAs or will it be chnged again???
Do you know anything about this?
Sorry for my bad english!
Thank you for your answer!