How can I get the ArraySize of some Symbol MqlRates?

 

How can I get the ArraySize of some Symbol MqlRates?


Tks

 
Daniel Arges:

How can I get the ArraySize of some Symbol MqlRates?


Tks

Solved using TerminalInfoInteger(TERMINAL_MAXBARS) as a parameter.

 

TERMINAL_MAXBARS is not the correct way to determine how many bars are available in the timeseries because it returns the settings property and not the number of bars. The actual number of bars can vary significantly from TERMINAL_MAXBARS.


If you plan on copying all available data to an array then use this: 

   MqlRates r[];
   int total = CopyRates(_Symbol, PERIOD_CURRENT, 0, INT_MAX, r);
   printf("%d bars copied", total);


If you just want to check how many bars are available then you should use:

   total = (int)SeriesInfoInteger(_Symbol, PERIOD_CURRENT, SERIES_BARS_COUNT);
   printf("%d bars reported by platform", total);  
 
nicholi shen:

TERMINAL_MAXBARS is not the correct way to determine how many bars are available in the timeseries because it returns the settings property and not the number of bars. The actual number of bars can vary significantly from TERMINAL_MAXBARS.


If you plan on copying all available data to an array then use this: 


If you just want to check how many bars are available then you should use:

Thank you!