MT4 EA Candles History

 

Hello,

 I have an EA that needs to get all M1 bars currentyl in the server for a symbol. How can I achieve that?

 

Thanks

 
1) Either use CopyRates() - it can be used in MQL5 as well.

2 ) Or you use iOpen(), iHigh(), iLow(), iClose() as off the oldest Bar (=Bars-1).

Read in the editors reference (F1) about the various functions and take advantage of the examples.
 

I used copyRates as you suggested for M1 bars. I can see in the client terminal that the oldest candle is 07/12/2016.

When calling the CopyRates I get only 2112 candles which the oldest value is yesterdays.

 
fxbusinessacc: When calling the CopyRates I get only 2112 candles which the oldest value is yesterdays.
  1. When you open a chart (copy rates) and don't have any history, you get about 2K bars from your broker for that TF.
  2. Here's how you can get all available from the broker.
 

Yes I know about downloading from History Center but I dont want that options since it is not automated.

I also know that they keep data for 45 days for M1s. My question can I get these using an EA? Or there is a limit 

 

You can use ChartNavigate to automate the process.

It isn't the most elegant solution.

See here 

 

Thanks.

 

Apart from the ChartNavigate there isn't any other way, is it? 

 
fxbusinessacc:

Thanks.

 

Apart from the ChartNavigate there isn't any other way, is it? 

Not that I am aware of, at least in code without using DLLs.

Happy to proven wrong though  

 
fxbusinessacc: Yes I know about downloading from History Center but I dont want that options since it is not automated.
  1. "Downloading from History Center" gets bars from MetaQuotes, not your broker.
  2. My post was downloading from your broker.
  3. You can't spend the 15 seconds per timeframe to get initial history, but you'll spend days trying to automate it?
 
whroeder1:
  1. "Downloading from History Center" gets bars from MetaQuotes, not your broker.
  2. My post was downloading from your broker.
  3. You can't spend the 15 seconds per timeframe to get initial history, but you'll spend days trying to automate it?
Dude it seems that you did not understand the question. Problem is that the EA cannot retrieve them. 
 
honest_knave:

Not that I am aware of, at least in code without using DLLs.

Happy to proven wrong though  

using DLLs? Can you explain further please?
Reason: