Live data from MT4 to Excel

You can export live data from MT4 to excel by enabling DDE server inside MT4 and connect MT4 with excel where you get live price quotes into excel file.

It is a simple process where you get an excel file with the data filled automatically. The data you get you can easily use in your favor in Excel file and make analysis.

You can use excel file to make necessary filters by filtering symbols, bid, ask, high and low price of a candle.

With exporting live data from MT4 to Excel you get a live feed of quotes inside excel file which you can use to analyze.

Excel gives you a lot of possible tools you can use to combine and analyze the data you get from the MT4.

The data you get from the MT4, low, high, bid and ask is a feed that changes on each tick, but you can make a combination of that data to get valuable insight about the currency pair.

There are few steps you need to take to export live data from MT4 to excel. Use MT4 and activate DDE server and then open DDE-Sample Excel file.

DDE is Dynamic Data Exchange protocol of Microsoft Windows used to dynamically exchange data between applications.

Here are few notes you need to remember when using DDE server and Excel file:

  • you get price quote of a certain symbol only on a new tick
    • you cannot get new data if you send a request to MT4
  • first quote you will get when starting the Excel file is N/A, but second quote will be from the chart
  • data from MT4 is received inside excel file only if MT4 is Online
  • history data inside MT4 cannot be retrieved to Excel over DDE protocol

Let’s go through each step so you can do it yourself and get MT4 data inside an Excel file.

First step is to go to MT4 and in the menu section select Tools -> Options.

Tools and option to enable DDE server

 Now, in the Server tab check the box next to “Enable DDE server”. Click OK and move to the next step to open Excel file.

Enable DDE server in MT4

When you are inside MT4 go to File -> Open Data Folder to find a DDE-Sample Excel file you can use.

File Open Data Folder

The folder that should open is located inside the Program Files or Program Files (x86) folder inside MS Windows.

If you do not open the Program Files folder then manually go to the location inside your PC and locate the Metatrader 4 installation folder.

Inside that folder you will see DDE-Sample Excel files read to be used. Click on it and open the Excel file.

Program Files MT4 Folder

Next you will receive a second message saying that you have external resources that could be unsafe.

Click the Update button and continue using the DDE-Sample excel file.

DDE Sample Excel File

The DDE-Sample excel file contains four rows with four currency symbols you can use immediately. The DDE data exchange is prepared and if you have MT4 open it should start to receive data right away.

When you start the Excel file you will see a warning message about using DDE protocol data exchange. Simply click the OK buttton.

When you compare the data when you start a DDE-Sample Excel file and when data starts to come from the MT4 platform you will see a difference.

I have put an excel file without data at the beginning and then an excel file with the data from MT4. Next to that image I have put the MT4 platform so you can see how the data inside the Excel file received the same information that is inside MT4.

You can see that the price of the currency symbol is transferred to the excel file.

The Excel file is populated with the data from MT4 using DDE Excel commands. There are limited number of commands you can use to export live data from MT4 to Excel.

Here are commands you can use:

  • BID request: = @MT4|BID!USDCHF
  • ASK request: = @MT4|ASK!USDCHF
  • HIGH request: = @MT4|HIGH!USDCHF
  • LOW request: = @MT4|LOW!USDCHF
  • TIME request in seconds: = @MT4|TIMESEC!USDCHF
  • TIME request: = @MT4|TIME!USDCHF
  • QUOTE request: = @MT4|QUOTE!USDCHF

If you think to get Open and Close of a candle that will not be possible. Because there is no DDE Command inside Excel to get those values.

DDE Command inside Excel

If you position yourself in the Excel field you will see which command is used to retrieve data from MT4.

If you open an Excel file and there is no column with the Time in minutes and only in seconds you can add that column yourself.

Simply go to the last column, in this case the last column is I column, after H column, and enter this command in the excel field for the currency symbol you want:

TIME request: = @MT4|TIME!USDCHF

You will immediately receive the time data for that currency symbol.

But, you will see some numbers which are not time if you do not format the excel field to be time.

In my case you can see that I have an odd number so I will format the field to be as a number.

To do that select the column, in this case it is column I, and click the right mouse button and select “Format Cells“.

In a new menu select the “Number” tab and in the possible options select “Time” under “Category“.

In the Time options select the time format you want to use. I have used 13:30:555 which is hh:mm:ss time format.

If you do not want to use a broker you can use free Metaquotes MT4 to get quotes from MT4.

That way you do not need a broker to export the data from MT4, but you simply open a demo account and get the MT4 data.

There is an option to create your own DDE excel if you cannot find one inside the MT4 folder.

The process is simple and here is what you need to do:

  • open new empty Excel file
  • Save it where you want to have it
  • Copy DDE commands inside excel file from below

In DDE-Sample excel file you have these commands:

  • BID request: = @MT4|BID!USDCHF
  • ASK request: = @MT4|ASK!USDCHF
  • HIGH request: = @MT4|HIGH!USDCHF
  • LOW request: = @MT4|LOW!USDCHF
  • TIME request in seconds: = @MT4|TIMESEC!USDCHF
  • TIME request: = @MT4|TIME!USDCHF
  • QUOTE request: = @MT4|QUOTE!USDCHF

To copy commands to new excel file you need to add ‘ (apostrophe) before and after MT4 inside command to look like this:

  • BID request: = @MT4|BID!USDCHF

So the difference between two commands in the DDE-Sample file is this:

  • = @MT4|BID!USDCHF
  • = @MT4|BID!USDCHF

Leave a Reply

Your email address will not be published. Required fields are marked *