Discovered a funny quirk in OrderSelect function with MODE_HISTORY.
It only selects whatever is listed currently in 'Account History' tab. So if you limit your account history tab to say 'TODAY', that's all you going to get in OrderSelect function. It seems all the other history is inaccessible unless you change 'Account History' tab back to 'All History'.
Can somebody verify that I am not dreaming.
That is not the case. I have managed to select orders which are previous to what is currently displayed in the tab.
Are you sure? OrdersHistoryTotal() returns the number of history items in the current history tab (which depends on the user settings). That doesn't make sense?
I had some related questions in the past that did not get answered, so I'll ask them again if you don't mind (form this thread: https://www.mql5.com/en/forum/122847):
Besides the 6 basic trade operations as detailed here https://docs.mql4.com/constants/trading,
I've noticed that when selecting from the history pool, there are also:
type 6 which is a 'balance' line and type 7 which is a 'credit' line.
1. Where is this documented? I simply can't find it anywhere.
2. Are there any other types or are the possible types only 0-7?
3. I have noticed that selecting from the history pool depends on
user settings of how long a history to show... Is there some way to
override this and read all history regardless of the user setting?
Are you sure?
I'll second that. As far as I'm aware, filtering the account history affects what code sees as well as what's displayed on screen.
Apologies. Perhaps this has changed with some release since I had the issue.
My issue was:
- Quite some time ago my code I was reading through the order-history trying to match items with the current day's DayOfYear().
- I got a false positive with a match against an order for the same DayOfYear() but from the previous Year(), a criterion which I had not checked for (silly me).
- This previous order was not visible in the history tab until I unfiltered it.
So I understand cloudbreaker and jjc agree with me.
As far as Gordon's question: I believe there are certain UNDOCUMENTED codes that can be used.
Can stringo or someone address this issue. It might have UNDESIRABLE effect on some scripts/experts.
Seconded, again. I've described this in the past as "a horrible design decision by Metaquotes" (https://www.mql5.com/en/forum/117038) and I stand by that.
Totally agree. Takes Model-View-Controller architecture and throws it out the window. Can't believe anyone has actively architected this.
But I still maintain that it did once work properly for me in some particular build version. I'm positive that I was able to retrieve a historic record 1 year old, which was currently filtered out of the history tab.