Hi does anyone know when we select the trades by position eg 0, 1, 2 in the 'trade pool' and 'history pool'.
0 mean the trade at the top of the list. But is this affected by how the rows are sorted when we manually clicked the column headers ?
Would it affect how the EA select trades, if we click on the column headers manually when the EA is processing the order list ?
- Zero mean the earliest one placed on the list. For the trade pool it would be first placed trade.
- For the history pool see Could EA Really Live By Order_History Alone? - MQL4 forum #2
- Clicking the column headers are irrelevant.
Hi does anyone know when we select the trades by position eg 0, 1, 2 in the 'trade pool' and 'history pool'.
0 mean the trade at the top of the list. But is this affected by how the rows are sorted when we manually clicked the column headers ?
Would it affect how the EA select trades, if we click on the column headers manually when the EA is processing the order list ?
Thanks,
Hip
By the way, the OrdersHistory also contains balance transfers, identifiable as OrderSymbol()==""
If you have 5 or 6 orders in your history you may be lulled in a false sense of security and think you have the pattern figured out.
I just checked it this evening to make sure and of 150 trades in the history there are not just a few out of date order, but lots. The first errors didn't appear until 30 items into the list.
I have just tested with this ea, and: not affects. But the 'history pool' depends on what history interval has been selected manually.
I have tested with your EA, and I found that in both 'trade pool' and 'history pool', the list is sorted by time the trade is opened.
i.e the same sort order when clicking the opening 'time' column header.
Thus, for the 'trade pool', 0 means the trade with the earliest opening time, while OrdersTotal-1 means the trade with the most recent opening time.
And for the 'history pool', 0 means the trade with the earliest opening time, while OrdersHistoryTotal-1 means the trade with the most recent opening time. (It does not use closing time of the trade).
Did you have the same conclusion ?
I have tested with your EA, and I found that in both 'trade pool' and 'history pool', the list is sorted by time the trade is opened.
i.e the same sort order when clicking the opening 'time' column header.
Thus, for the 'trade pool', 0 means the trade with the earliest opening time, while OrdersTotal-1 means the trade with the most recent opening time.
And for the 'history pool', 0 means the trade with the earliest opening time, while OrdersHistoryTotal-1 means the trade with the most recent opening time. (It does not use closing time of the trade).
Did you have the same conclusion ?
There is no explicit documentation of the sorting order of this list, so better considering it as random sorted, as Dabbler suggested. It can depend on brokers also.
Perhaps there is a more experienced programmer here, who can point the documentation of this. But, if not, when the sequence of list is critical, you should build a custom array of it, then sort yourself.
Hi does anyone know when we select the trades by position eg 0, 1, 2 in the 'trade pool' and 'history pool'.
0 mean the trade at the top of the list. But is this affected by how the rows are sorted when we manually clicked the column headers ?
Would it affect how the EA select trades, if we click on the column headers manually when the EA is processing the order list ?
Thanks,
Hip
Would it affect ... ? Yes if you using Intel 4004 processor. Today processors is so fast, it will finish the job before you even start it.
You can always filter them out like ...
int Filter = The_Limit ; // put time or ticket number here for (pos = 0; pos <= OrdersHistoryTotal(); pos ++) { if (OrderSelect (pos, SELECT_BY_POS) == true) { if (OrderOpenTime () <= Filter) continue ; // We're not looking for the lowest time nor ticket ... // if (OrderCloseTime () <= Filter) continue ; // ... because the biggest time or the biggest ticket number ... // if (OrderTicket () <= Filter) continue ; // ... is the newest order. else { // do the job, then ... Filter = OrderOpenTime(); // Filter = OrderCloseTime(); Filter = OrderTicket (); } } }
Ticket number is incremented, so the biggest ticket number is the newest order.
<code is not compiled>
Have fun :)
- 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 does anyone know when we select the trades by position eg 0, 1, 2 in the 'trade pool' and 'history pool'.
0 mean the trade at the top of the list. But is this affected by how the rows are sorted when we manually clicked the column headers ?
Would it affect how the EA select trades, if we click on the column headers manually when the EA is processing the order list ?
Thanks,
Hip