How can I set the OrdersHistory to Today, Last_3_Days, Last_Week?

 

Does anybody know how to set the OrdersHistory to Today, Last-3-Days or LastWeek acc. to setting it to All_History, Last_Month,...

I am using this function:

 void SetOrdersHistory(int x){
   // https://forum.mql4.com/ru/14463/page5#401551
   // https://forum.mql4.com/46407#596672
   // 33058 - All History, 33057 - Last 3 Months, 33063 - Last Month
   //#define MT4_WMCMD_ALL_HISTORY 33058
   //#define MT4_WMCMD_3_MONTHS 33057
   //#define MT4_WMCMD_LAST_MONTH 33063
   int main = GetAncestor(WindowHandle(_Symbol, _Period), GA_ROOT);
   //PostMessageW(main, WM_COMMAND, MT4_WMCMD_ALL_HISTORY, 0);
   PostMessageW(main, WM_COMMAND, x, 0);
   Sleep(5000);
}
 

Not so easy I think. You will have to find the command for "Custom Period" but then you will have to select the appropriate value in the combo, or set the date yourself.

 
That code was pre-build 600 Could EA Really Live By Order_History Alone? - MQL4 forum
If you are using that code what's the problem?
 
WHRoeder:
That code was pre-build 600 Could EA Really Live By Order_History Alone? - MQL4 forum
If you are using that code what's the problem?

As I wrote the problem is the code above is working only for

33058 - All History

33057 - Last 3 Months

33063 - Last Month

I'd like to know the 'magic-numbers' for shorter time-periods like today, 3 days or last week and - thanks angevoyageur, I haven't thought of that - for "Custom Period".

I looped from MT4_WMCMD_SAVE_AS_PICTURE 33054 to MT4_WMCMD_SAVE_Statement  33064 and none of the numbers except the known three changed the earliest available order.

So I hoped someone else could have been happy to find something?

 

Hello, 

someone know if is it possible to use codes for setting "daily" history ?

Reason: