Download MetaTrader 5

Please help me to load data

To add comments, please log in or register
Have you developed an application? Publish it in Code Base!
aaronrascon
140
aaronrascon 2016.01.06 06:09 
Hi. I am doing a multi-currency, multi-timeframe EA. I have the problem that the EA is sending just a few signals because it doesn´t load the historical data for every pair and timeframe. I can´t have a open window for every pair in every timeframe so I have no idea about how to solve it. If someone can help me I will thank you so much.
Stuart Browne
5818
Stuart Browne 2016.01.06 06:26  
aaronrascon:
Hi. I am doing a multi-currency, multi-timeframe EA. I have the problem that the EA is sending just a few signals because it doesn´t load the historical data for every pair and timeframe. I can´t have a open window for every pair in every timeframe so I have no idea about how to solve it. If someone can help me I will thank you so much.

MTF MC is a major pain in MT but there are a few things you can do to get around the limitations

First, make sure all pairs you are interested in trading show up in the market watch.

Secondly, one way you can "force" MT to download data is by trying to get the value of a price in the past. eg use something like

double dummyPrice = iOpen("USDCHF",PERIOD_H1,500);

 So you would create a loop with all of the pairs and all of the TFs you need and get a value from way in the past. Stick this in an initialisation function that runs once when the EA first loads. I recommend putting it AFTER OnInit() has run. 

The only other way to do it would be to open a chart for each pair and scroll back as far as you can. This will then write the history to file so it will be available next time you run the EA

Oh and one other thing, always best to use a timer event rather than a tick event when you are doing MTF MC EA's

aaronrascon
140
aaronrascon 2016.01.06 06:32  
I really appreciate your fast reply. I will try it. Happy new year.
Stuart Browne
5818
Stuart Browne 2016.01.06 06:33  
aaronrascon:
I really appreciate your fast reply. I will try it. Happy new year.
Very welcome :)
To add comments, please log in or register