The available data in Dukascopy is raw in the form of files spanning only one hour, so it's obvious that tools will be needed to download and parse it. Before other methods to get the data were available, a series of scripts were useful to download Dukascopy free tick data, and they are still valid till now. PHP scripts are so simple, with non-commercial quality code, but working well.
These PHP scripts are available in the tick data downloads page.
- There are 4 scripts
- A script to download the Dukascopy data called "download_dukascopy_data.php". If you have files already downloaded on the hard disk, the script does not attempt to them, while it just requests the files not existing, to make this work successfully, dates in the $currencies array at the beginning of the script should be set to the date of the last download; as the standard Unix timestamps are used by Dukascopy (epoch date, which equals the number of seconds since 01.01.1970). To convert from a regular date to such a Unix timestamp with ease, Epoch Converter could help, a very easy to use online tool.
- A script to process the downloaded data, assuming that it is present in the same directory as the last script where the data was downloaded too (process_dukascopy_data.php); this script needs some parameters, it doesn't need to be described or you can revise the next script.
- A small shell script to process all the downloaded data with .bat extension for windows and .sh extension for Linux.
How to download and convert to CSV in windows
First you need to go to windows PHP download part and get the latest binary version zip file, then decompress it to c:\php\, then decompress other scripts downloaded from same directory too.
Rename c:\php\php.ini-development to c:\php\php.ini. If there is no file named php.ini-development in the folder, use php.ini-dist or any other php.ini-something file there.
- Edit c:\php\php.ini;
- Search for: ;extension=php_curl.dll
- Remove the semicolon in front of the line
- Add an "ext/" in front of "php_curl.dll"
- Then, it should look like: extension=ext/php_curl.dll
- Save the file and quit.
If a zip error occurred and an ext/php_zip.dll is in the PHP installation, repeat the last steps too for extension=ext/php_zip.dll.
- Go to the 7-Zip download page, download the command line version, unpack it and put 7za.exe in the same directory (c:\php\).
- Click "start->run".
- Type: cmd
- Click "ok" (in windows 7 / vista, type cmd then hit enter in "search programs and files" box of start menu).
- In the command window type: cd \php
- Type: php download_dukascopy_data.php
Relax, then wait, don't rush at all, this will take ages. The progress can be checked by exploring the currency pair directories till get filled. If any abnormal error occurs, repeat the process again after it's finished, it will just download missed files in the last run due to connection errors.
If just some of the available currency pairs are needed, the array present at the beginning of "download_dukascopy_data.php" file can be edited. The order currency pair download can be switched, or even a complete removal of the unwanted pairs is possible. The time to start to download of each pair is present next to it in the form of a Unix timestamp number, it's set to the earliest available date by default, it can be postponed to a later date by editing this number by the help of Epoch Converter.
- After the download has completed, if the EURUSD data up to 01.01.2012 for instance are needed:
- Type: php process_dukascopy_data.php EURUSD 200702 201201 EURUSD.csv
- The output will be found in EURUSD.csv
- Alternatively, you can type: process.bat
The later will batch process all the currency data. The error spam at this step can be safely ignored. Note: if process.bat or process.sh is involved, the ending dates in them may need to be updated first to get the full data range.
Now assuming that everything went fine, the CSV files should be now in the same c:\php folder and it's ok to proceed with preparing the tick data for Metatrader 4.
Warning: Adequate disk space must be available. As by 2012, the downloaded tick files are over 20 GB in size, and by adding up the size of the resulted CSV files, the total size could exceed 100 GB.