Problem with MT4 Account History

To add comments, please log in or register
parham.trader
613
parham.trader  

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,

Mehmet Bastem
846
Mehmet Bastem  
parham.trader:

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);
   
}

parham.trader
613
parham.trader  
Mehmet Bastem:

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

William Roeder
18344
William Roeder  
parham.trader: 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?
  1. The code is the same as you selecting Account History tab, right click, All History click. Nothing more.

  2. It takes time to download history, you need to return and wait at least 5 seconds, before continuing. Do not call it every tick.

  3. You get whatever your broker sends. Nothing to do with MT4, nothing to do with settings.

  4. 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

  5. Mehmet Bastem: please add this code your experts.
    //+------------------------------------------------------------------+
    //|                                               WindowsMessage.mq4 |
    //|                        Copyright 2018, MetaQuotes Software Corp. |
    //|                                             https://www.mql5.com |
    //+------------------------------------------------------------------+
    #property copyright "Copyright 2018, MetaQuotes Software Corp."
    #property link      "https://www.haskayabilgi.com"
    Please remove your copywrite from my code.
              Order History sort by closing date - Indices - MQL4 and MetaTrader 4 - MQL4 programming forum
Mehmet Bastem
846
Mehmet Bastem  
whroeder1:
  1. The code is the same as you selecting Account History tab, right click, All History click. Nothing more.

  2. It takes time to download history, you need to return and wait at least 5 seconds, before continuing. Do not call it every tick.

  3. You get whatever your broker sends. Nothing to do with MT4, nothing to do with settings.

  4. 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

  5. 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
To add comments, please log in or register