In this guide, we will cover how to download historical data from your broker using MetaTrader 4.
Historical data plays a crucial role in backtesting trading strategies, which allows traders to simulate trading with past market conditions. This guide will walk you through each step of the process, ensuring you have all the necessary information to effectively gather the data you need from your broker (or from MetaQuotes).
Access Chart Settings
- First, open MetaTrader 4.
- Navigate to Tools > Options
- In the option menu, click on Charts.
- Here, you will see various settings that determine how much historical data is displayed in your charts.
- Max bars in history: This setting controls the number of bars in the history database. By default, it is set to 512,000 bars, which is typically more than sufficient.
- Max bars in chart: This is set to 65,000 bars by default and regulates how many bars are displayed in your chart.
Ensure these settings are appropriate for your needs. If your requirements are lower, adjust accordingly; however, it’s best to keep these numbers at default unless there’s a specific need to change them.
Open a Chart
Select the currency pair you are interested in, for example, EUR/GBP. Open a chart window for this pair. The chart will open in the default timeframe; however, you can adjust this as needed.
- Go to the currency pair on the left panel, and right-click, then click on Chart Window.
- After clicking Chart Window, the chart should appear.
- The default timeframe is selected as H4, which is 4 hours. You can adjust this to your preference. For now, let’s download data for H4.
Turn off Auto-Scroll
Ensure that ‘Auto Scroll’ is disabled to prevent the chart from jumping to the most recent data while you’re loading historical data.
Option A: From Toolbar
- This option can usually be toggled off directly on your chart toolbar.
Option B: From Properties Menu
- Right-click on the chart and go to Properties.
- In the properties menu, click on Common, and untick Chart autoscroll.
- Press OK to save the change.
Download Historical Data From Your Broker
To start downloading the data, left-click and drag the chart and as you drag more and more data will be downloaded. In the picture below, you can see, by dragging the chart, historical data until 22 December 2022 has been downloaded.
When the chart stops scrolling further, it means you have reached the limit for downloadable data for the selected Currency Pair and Timeframe, in this case, EUR/GBP and H4.
Or, it could also mean you have reached the limit for Max bars in chart, which is set to 65,000 by default. But, this is highly unlikely to be the case since 65,000 bars are more than sufficient in most cases.
Using Home Button To Download Historical Data Faster
Alternatively, for a faster way to download data as opposed to clicking and dragging, you can press the Home key on your keyboard. This takes you to the earliest data available quickly. If press the Home button and hold it until it stops loading new data, it means you’ve downloaded all of the available data for the selected currency pair and timeframe.
In the screenshot below, after pressing the home button until the chart stopped scrolling, you can see it has downloaded data until 12 December 2022 for the EUR/GBP currency pair and H1 Timeframe.
Note: On your broker/chart, the date and amount of data will be different. At the moment I created this tutorial, I was able to download data until December 2022, but it does not mean you need to get the same. If I would repeat the same process on a new account 6 months later, I would most likely download data until June 2023. It would be the same amount of bars but a different date range.
Checking Data Availability
Scroll through your chart to check how much data is loaded. For instance, pressing Home may reveal data going back to a specific date, indicating the range of historical data available from your broker for that chart.
Download Data for Different Currency Pairs/Instruments and Time Frames
Switch between Currency Pairs/Instruments and time frames to load historical data for each one. For the Currency Pair/Instrument, you may select EURGBP, GBPJPY, Gold, etc.. For the timeframe, you may start with a four-hour time frame and then switch to one hour, 30 minutes, 15 minutes, and so on. You can use the Home button for each time frame to quickly load all available data since it is the fastest way to download data.
Download Data From the History Center (Alternative way)
This option is often mistaken by some people as the right way to download historical data for your specific broker. Downloading historical data from the History Center downloads data from the MetaQuotes and not from the specific broker that you are using. But, if you find the data from your broker insufficient, you can download additional data from MetaTrader 4’s History Center. It is better than having no data.
- Navigate to Tools > History Center.
- Select the currency pair or instrument.
- Select the timeframe.
- This will display all the data available for the selected Currency Pair and timeframe. The screenshot below shows that MetaQuotes has 65,000 records available for EURGBP and M1 timeframe.
- Click Download. This data comes from MetaQuotes and not directly from your broker’s servers. It might not be broker-specific but can be useful if you need more extensive historical data.
Verify Data Using an Indicator
A good way to check if the data downloaded from your broker is sufficient for your strategy is by testing it with an indicator on the chart.
- Open your desired currency pair.
- Select the timeframe.
- Click the Shift end of the chart from the right border icon.
- Add your indicator to the chart.
- After adding the indicator to the chart, it shows that we have 21970 bars available, and it is sufficient to display 50 or 100 signals.
- You can adjust the indicator settings to see how the use of historical data changes.
Depending on how many signals you choose to display, e.g. 50 or 100, the use of historical data will change. In some cases, you may get a message saying the historical data is not enough to display the amount of signals.
This is usually not a big issue, since it may be caused by the indicator settings (such as setting a high lookback bars value) looking for patterns that are very rare to find. In such cases, you can adjust the settings (e.g. decreasing the number of lookback bars) and optimize for better results.
Conclusion
Downloading and managing historical data in MetaTrader 4 is crucial for conducting thorough market analysis. While using broker-specific data is preferred for accuracy, the History Center also serves as a good alternative if additional data is required. This guide should help you efficiently manage and download the historical data needed for your trading activities on MetaTrader 4.