Download Download all ticks of a symbol's history for MetaTrader 5

Download all ticks of a symbol's history

Download all ticks of a symbol's history

This professional-grade solution for MetaTrader 5 helps traders achieve greater efficiency in their daily workflow. This Expert Advisor serves as automated trading software. It is utilized to monitor financial markets and execute trades based on predefined algorithmic rules, enabling precise position management without the need for constant manual oversight.

MT5 expert Pack 📂

How to Setup and Use Download all ticks of a symbol's history

1. Installation: Open the "File" menu, select "Open Data Folder," navigate to MQL/Experts, paste your file, and restart the terminal.

2. Activation: Drag the EA from the Navigator onto a chart, ensure "Allow live trading" is checked in the Common tab, and verify the AutoTrading button is green.

3. Optimization: Right-click your chart, choose "Expert List," click "Properties" to adjust inputs, and save your preferred setup as a set file for future use.

4. Maintenance: Regularly check the "Experts" tab in the terminal window to monitor trade logs and potential execution errors.

Frequently Asked Questions

Q: Why is my EA not opening trades? A: Check the "AutoTrading" button, ensure "Allow live trading" is enabled, and verify your broker allows automated trading on your account type.

Q: Can I run multiple EAs on one chart? A: No, each chart can only host one active EA; however, you can open multiple charts for different currency pairs to run several EAs.

Q: What does the "smiley face" icon mean? A: A smiley face in the top-right corner of the chart indicates the EA is successfully running; a frowny face means it is disabled.

Description & Settings


This expert advisor code will scan the user's broker's market watch and extract symbols for which it will download all available ticks , or ticks up to a date.
It may help you to download all symbol history for your backtest , or create a custom chart from those ticks.
The terminals will cache the ticks on the data folder so make sure you have adequate hard drive space.
To facilitate download of the symbols we need a download manager first.
Structure CDownloadManager contains all the info we will need to retain.

The state of the download (started/finished)

the list of the symbols to scan

the current symbol

and the index of the symbol being scanned
We will also need to read and write to the hard drive and since we are working with symbols we create 2 quick functions to write and read strings from binary files.
The save string to file function :
It receives :

file handle
f
, of a file opened for write and binary flags
FILE_WRITE|FILE_BIN
the string to write to the file
It writes an integer length of how many characters are in the string and then stores each character in the string.
The load string from file function:
It receives:

file handle f of a file opened for reading as binary , flags FILE_READ|FILE_BIN
It reads an integer length of how many characters to expect at that point in the file.It proceeds to read each character into a char array and then create a string from that char array which is returned as the result of the load as a string.
Back to the CDownloadManager structure . We need a way to initialize the manager and fill it up from the market watch:
Pretty straightforward :

ask for how many symbols are in the market watch (active)

resize our m_symbols array to receive them

loop into the total symbols and request the name of the symbol
We are also responsible for managing the download of the symbol data so we'll need a function that is essentially the manager:
How the system works :

The chart opens , we need 1 chart , and a timer is set.

That timer executes ,we cancel the timer

We check if this is a new download or a continuing download

If its a new download we set it up by grabbing all the symbols

If its a continuing download we download data for the current symbol
This is the part of the code conducting the download on timer :

You May Also Like

RobotFX does not own any of the code provided on this platform. All tools are freely available on the internet; we simply index and re-offer them for download. We are not responsible for any financial losses that may occur. Trading responsibilities rely solely on the traders downloading and using the displayed Expert Advisors, indicators, and scripts. These tools are provided for educational purposes only and may require modification or optimization to align with a trader's specific strategy or needs.
© ROBOTFX - Best MetaTrader Expert Advisors & Indicators