Problem with obtaining historical data

 

Hi guys,


I am building EA strategy and I have some troubles with obtaining data. The strategy needs to send M30 OHLC data 1000 bars backwards to my R client, so I have written this: 

MqlRates rates[];
ArraySetAsSeries(rates,true);
int copied = 0;

int count = 1000;
copied = CopyRates(Symbol(),PERIOD_M30,0,count,rates);
        
for(int i = 0; i <= copied; i++)
{
  msg = msg + DoubleToString(rates[i].open) + "|" + DoubleToString(rates[i].high) +
  "|" + DoubleToString(rates[i].low) + "|" + DoubleToString(rates[i].close) + "||";
}
        
InformPullClient(pSocket, msg);

The problem is that the max value of count can be only something aroung 67. If I set count variable higher, I get no data and in MT5 I get: nothing to analyze. I checked Symbols/Bars in MT5 and the data should be there. I also tried the iClose, iOpen..., but there is the same problem with maximal shift.


Thank you. 

 
Dominik Čoupek:

Hi guys,


I am building EA strategy and I have some troubles with obtaining data. The strategy needs to send M30 OHLC data 1000 bars backwards to my R client, so I have written this: 

The problem is that the max value of count can be only something aroung 67. If I set count variable higher, I get no data and in MT5 I get: nothing to analyze. I checked Symbols/Bars in MT5 and the data should be there. I also tried the iClose, iOpen..., but there is the same problem with maximal shift.


Thank you. 

Please refer to this link

Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access
Documentation on MQL5: Timeseries and Indicators Access / Organizing Data Access
  • www.mql5.com
Organizing Data Access - Timeseries and Indicators Access - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
Reason: