How to download historical data of MetaTrader 4 is the subject of this blog post I posted today. Why do I select this subject? Let me tell you slowly.
Today, few hours ago, one of my friend (he isn’t actually a pretty near friend, you know) was asked me why he can’t back test his expert advisor on MetaTrader 4 for a specific date an time? I was told him that his history data wasn’t successfully downloaded from the server so with a poor history data, a missing date and time is nearly always happened all the time during back testing. Available solution is only re-download the history data from the broker server and then with a fresh historical data a new back testing could be executed.
Then I told my friend to re-download the historical data then start a back testing again. For a geek on the industry re-download historical data is a simple task; however when it’s come to a newcomer it’ll become a very hard issue. A light is needed for resolve the situation and this blog post was created for it. So? It’s now the time we discuss the needed light.
1. First step: setting up the maximum bars on the history
This step is important for make sure that we have enough space for save the downloaded historical data later. Open MetaTrader -> Tools -> Options -> Chart -> Max bars in history. change the number of maximum bar into whatever value you think you’ll need it, but commonly is set to 9999999999 or 2147483647 mean we’ll download all historical data available on the server.
Fig. 1: Max bars in history
2. Second step: setting up the maximum bars on the chart
Then, set the maximum bars on the chart by change the number on the column “Max bars in chart” into 9999999999 on the same location with above explained “Max bars in history”.
Fig. 2: Max bars in chart
3. Third step: restart the MetaTrader 4
Restart MetaTrader 4 application to make above change take effect.
4. Fourth step: download historical data through MetaTrader 4 client terminal
Open Tools -> History Center then double click your symbol. Double click timeframe 1 Minute (M1) for easier use later.
Fig. 3: Select desired symbol of currency pair you’d like to download
Then, click download button on the bottom of the window then wait ’till download process is done.
5. Final step: data use
On above explanation I was let you know that we should download data with timeframe 1 Minute (M1). Why? Because of data 1 Minutes timeframe is the most flexible one compared with other timeframe data. If we’ve data of 1 Minute timeframe that’s the lowest timeframe, we could convert it to the higher timeframe if we need it using “Period Converter” script. This thing remove the need of multiple download for same symbol of currency pair but different timeframe. If we only will use 1 Minute data so you we don’t need to do anything but then start to doing a backtesting as usual with new fresh downloaded historical data.