Hi friends,
Hope you're doing great,
Today I faced with a very special issue regarding the Account History of the MT4. I've written an EA and now I'm testing its operation on a demo account on real time. Within my EA code, I've written a procedure to save the details of the order with the info I need about any order in a CSV file. As I compare the closed orders saved on my file with the Account History of the MT4, I found out that some of the closed orders that are saved on my CSV files are not included in the Account History that I downloaded from the MT4 Account History tab of the MT4. (I've already updated the history to include all existing orders by right click on it and choose the "All History" in the Account History tab).
Now I wonder how is it possible to have such an issue. Your kind participation with this discussion is highly appreciated.
With my best regards,
please add this code your experts.
the code load list all history
//+------------------------------------------------------------------+ //| WindowsMessage.mq4 | //| Copyright 2018, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2018, MetaQuotes Software Corp." #property link "https://www.haskayabilgi.com" #property version "1.00" #property strict //+------------------------------------------------------------------+ //| Script program start function | //+------------------------------------------------------------------+ // 33058 ALL HISTORY // 33054 GRAFİĞİ KAYDET // 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 #include <WinUser32.mqh> #import "user32.dll" int GetAncestor(int, int); #import #define GA_ROOT 2 // https://forum.mql4.com/ru/14463/page5#401551 #define MT4_WMCMD_ALL_HISTORY 33058 void OnStart() { //--- int main = GetAncestor(WindowHandle(Symbol(), Period()), GA_ROOT); PostMessageA(main, WM_COMMAND, MT4_WMCMD_ALL_HISTORY, 0); }
please add this code your experts.
the code load list all history
Thank you so much for your guidance,
I didn't get should I add it to my EA or create a new Script and add the above mentioned code to the Script and then execute it on MT4?
Is it an MT4 bug that can not load all trade history thoroughly or it is related to a setting issue that should be solved by myself?
Thanking in advance for your kind guidance
- The code is the same as you selecting Account History tab, right click, All History click. Nothing more.
- It takes time to download history, you need to return and wait at least 5 seconds, before continuing. Do not call it every tick.
- You get whatever your broker sends. Nothing to do with MT4, nothing to do with settings.
- Do not assume history is ordered by date, it's not.
Could EA Really Live By Order_History Alone? (ubzen) - MQL4 and MetaTrader 4 - MQL4 programming forum
Count how many lost orders from the last profit order - MQL4 and MetaTrader 4 - MQL4 programming forum - Mehmet Bastem: please add this code your experts.Please remove your copywrite from my code.
//+------------------------------------------------------------------+ //| WindowsMessage.mq4 | //| Copyright 2018, MetaQuotes Software Corp. | //| https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2018, MetaQuotes Software Corp." #property link "https://www.haskayabilgi.com"
Order History sort by closing date - Indices - MQL4 and MetaTrader 4 - MQL4 programming forum
- The code is the same as you selecting Account History tab, right click, All History click. Nothing more.
- It takes time to download history, you need to return and wait at least 5 seconds, before continuing. Do not call it every tick.
- You get whatever your broker sends. Nothing to do with MT4, nothing to do with settings.
- Do not assume history is ordered by date, it's not.
Could EA Really Live By Order_History Alone? (ubzen) - MQL4 and MetaTrader 4 - MQL4 programming forum
Count how many lost orders from the last profit order - MQL4 and MetaTrader 4 - MQL4 programming forum - Please remove your copywrite from my code.
Order History sort by closing date - Indices - MQL4 and MetaTrader 4 - MQL4 programming forum
https://forum.mql4.com/ru/14463/page5#401551
- The code is the same as you selecting Account History tab, right click, All History click. Nothing more.
- It takes time to download history, you need to return and wait at least 5 seconds, before continuing. Do not call it every tick.
Is there any way to find out whether the script downloaded All History ? because I want to save ALL HISTORY in a CSV file so it would be important for me to be assure that all history is downloaded thoroughly.
The only solution I found is to use sleep(20000) and then continue but it does not seem to be a logical remedy because the procedure of downloading all orders history might take even longer than 20 seconds.
Thanking in advance for your kind guidance;
The script does not download any history. All it does change the setting — same as what you already said you did.
The terminal downloads whatever the broker sends. That may be limited by the broker despite what the documentation says.
Account
History - Terminal - User Interface - MetaTrader 4 Help @Context Menu
When the next tick arrives, you have whatever you have.
The script does not download any history. All it does change the setting — same as what you already said you did.
The terminal downloads whatever the broker sends. That may be limited by the broker despite what the documentation says.
Account
History - Terminal - User Interface - MetaTrader 4 Help @Context Menu
When the next tick arrives, you have whatever you have.
Thank you for your help,
But when I use the above-mentioned code (or even when I do it manually), it takes about 40 seconds for MT4 to show ALL trade history in the "account History" tab which means that there are so many ticks coming in but the setting is not changed until passing about 40 seconds.
Is there any way to find out whether the script downloaded All History ? because I want to save ALL HISTORY in a CSV file so it would be important for me to be assure that all history is downloaded thoroughly.
The only solution I found is to use sleep(20000) and then continue but it does not seem to be a logical remedy because the procedure of downloading all orders history might take even longer than 20 seconds.
Thanking in advance for your kind guidance;
No idea ?
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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 friends,
Hope you're doing great,
Today I faced with a very special issue regarding the Account History of the MT4. I've written an EA and now I'm testing its operation on a demo account on real time. Within my EA code, I've written a procedure to save the details of the order with the info I need about any order in a CSV file. As I compare the closed orders saved on my file with the Account History of the MT4, I found out that some of the closed orders that are saved on my CSV files are not included in the Account History that I downloaded from the MT4 Account History tab of the MT4. (I've already updated the history to include all existing orders by right click on it and choose the "All History" in the Account History tab).
Now I wonder how is it possible to have such an issue. Your kind participation with this discussion is highly appreciated.
With my best regards,