Home Forex Popular Questions Forex how to export ohlc automatically to excel?

Forex how to export ohlc automatically to excel?


Forex trading is an exciting and dynamic market that is popular among traders of all levels. Traders need to analyze the market and make informed decisions based on the data they gather. One way to do this is by exporting OHLC (Open, High, Low, Close) data from their trading platform to Excel. This article will explain how to export OHLC data from Forex trading platforms automatically.

OHLC data is a critical tool used by traders to identify market trends and make informed trading decisions. OHLC data is a four-point data series that consists of the opening price, the highest price, the lowest price, and the closing price of a particular time frame. This data can be exported to Excel and analyzed to identify patterns and trends that can help traders make better decisions.


There are several ways to export OHLC data to Excel, but the most efficient way is to use an automated process. This process involves using a programming language such as Python, which can be used to automate the process of exporting data from a trading platform to Excel. The following are the steps involved in exporting OHLC data automatically using Python.

Step 1: Install Python

The first step in exporting OHLC data to Excel automatically is to install Python. Python is a popular programming language used by traders to automate trading tasks. To install Python, visit the official Python website and download the latest version of Python.

Step 2: Install Required Libraries

After installing Python, the next step is to install the required libraries. There are several libraries needed for exporting OHLC data to Excel automatically. These libraries include pandas, openpyxl, and xlrd. To install these libraries, open the command prompt and type the following commands:

pip install pandas

pip install openpyxl

pip install xlrd

Step 3: Connect to Trading Platform

After installing the required libraries, the next step is to connect to the trading platform. Most trading platforms have APIs (Application Programming Interfaces) that allow traders to access data and execute trades programmatically. To connect to the trading platform, traders need to obtain the API key and secret from the platform’s website.

Step 4: Retrieve OHLC Data

The next step is to retrieve OHLC data from the trading platform. This can be done using the API provided by the trading platform. Traders can use Python to send a request to the API and retrieve the OHLC data. The data can be stored in a pandas DataFrame, which is a data structure used for data manipulation and analysis.

Step 5: Export Data to Excel

After retrieving the OHLC data, the final step is to export the data to Excel. Traders can use the openpyxl library to create a new Excel workbook and write the OHLC data to a worksheet. The xlrd library can be used to read the data from the worksheet and perform further analysis.


Exporting OHLC data to Excel automatically is a useful tool for traders who want to analyze market trends and make informed trading decisions. Using Python, traders can automate the process of retrieving OHLC data from the trading platform and exporting it to Excel. This process can save time and effort and provide traders with valuable insights into the market.