Check if history is loaded

 

I'm trying to find a solid way to check if the history is loaded in a Custom Indicator. I only want my indicator to run when I've got my history available.

I could try to use OrdersHistoryTotal() and check if that amount is larger than 0, but that would fail on new accounts? Or does the initial deposit always triggers the OrdersHistoryTotal() to return 1? Other possibility I found was checking for the accountnumber, the history comes in together with the account number if I'm right. Is the history loaded at once, or in steps? Example: when the history pops up in the tab, is this when all the rows are loaded, or are they async loaded?

Is there an "error proof" way to check if all history selected (for the given period in the users history tab) is loaded?

 
RafaelV: Is there an "error proof" way to check if all history selected (for the given period in the users history tab) is loaded?
You should be specific in your posts. You're talking about order history, not price history.
#include <WinUser32.mqh>
#import "user32.dll"
        int             GetAncestor(int, int);
#import
void     EnableAllHistory(){                          // #define GA_ROOT 2
   // https://www.mql5.com/ru/forum/110207/page5#401551
   #define MT4_WMCMD_ALL_HISTORY 33058
   int      main = GetAncestor(WindowHandle(Symbol(), Period()), GA_ROOT);
   PostMessageA(main, WM_COMMAND, MT4_WMCMD_ALL_HISTORY, 0);
}
 
WHRoeder:
You should be specific in your posts. You're talking about order history, not price history.


I don't think this solves the OP's issue though, I think he wants to determine if the history has been pulled from the Server to the client . . .
 
WHRoeder:
You should be specific in your posts. You're talking about order history, not price history.


I'm sorry. I'll try to explain it a bit more: when MT4 starts up, the order history gets loaded with all the past trades and current open trades. The init() function of indicators run direct at the start, but I want to check if the order history is loaded before I let my indicator proceed. I'm now solving this by checking if MT4 is connected and the account number is set. This works thus far, but is this "solid"? Will this always work and not rely on the connection speed / server speed / ...

RaptorUK:
I don't think this solves the OP's issue though, I think he wants to determine if the history has been pulled from the Server to the client . . .
Correct, that's exactly what I'm trying to do.
Reason: