The Initial Thread Race

To add comments, please log in or register
Carl Schreiber
Moderator
7119
Carl Schreiber  

Since now all techn. questions should go to the forum here is mine:

The start of an indicator or an EA starts a thread race of various things. Especially if one uses OOP the setup of all the instances of the classes took quite a while - that's my experience!

In order to start the request of the needed historical data as early as possible, so that they are downloaded while the setup of the EA or the indicator is executed I would like to do e.g.:

int OnInit() {
   MqlRates r[];
   CopyRates(_Symbol, _Period,                                       0, TerminalInfoInteger(TERMINAL_MAXBARS)+1, r);
   CopyRates(_Symbol, _Period,   TerminalInfoInteger(TERMINAL_MAXBARS), TerminalInfoInteger(TERMINAL_MAXBARS)+1, r);
   CopyRates(_Symbol, PERIOD_M1,                                     0, TerminalInfoInteger(TERMINAL_MAXBARS)+1, r);
   CopyRates(_Symbol, PERIOD_M1, TerminalInfoInteger(TERMINAL_MAXBARS), TerminalInfoInteger(TERMINAL_MAXBARS)+1, r);
   ...
}
My question: will the call of CopyRates(..) interfere with each other or will that create independent threads that request and download their data?
To add comments, please log in or register