• phone +1.954.4163300
  • time-img Mon.-Fri. 10:00-18:00 EST
English Germany Turkish

ExcelLink supports only Office 2003 & XP. If you need support for newer Excel versions please use XLSgate. XLSgate is also our product.

ExcelLink can connect trading platforms to Excel. It's a DLL library that can be used from any application, such as MetaTrader and TradeStation.

Description

This add-on exchanges data between Excel and other trading tools like TradeStation, Wealth Lab, and MetaTrader. Although they don’t have a native support for Excel, we may occasionally need to use Excel for its capabilities.

Features

You can store strings, integers, and double types from a single application as well as read them from another (or the same) application in real time; for example, storing data from TradeStation and reading it in MetaTrader. Highlights include the following:

  • Compatible with TradeStation, MetaTrader4, MetaTrader5, NinjaTrader, and many others
  • Fast and lightweight
  • Uses native API from Microsoft Excel to ensure compatibility with all versions of Windows
  • Written in C++
  • New: Unicode version available
  • New: 64bit version available
  • Multithread safe
  • Free of charge FOREVER
  • Ability to format cells by font size and color
  • Provides an “Autofit” function to automatically adjust the cell width and height
  • Load and save Excel files
  • Send operations commands like '=sum(a1+a2)
  • Rename sheets
  • Support of Office 2003 & XP
  • Supports sheets for all operations (can send output, read input, and perform calculations within a designated sheet)

Compatibility

  • MetaTrader4 supports all builds (including new releases)
  • Tested with TradeStation 8.x/9.x, and will be compatible with all upcoming versions
  • Tested with NinjaTrader
  • Tested with MultiCharts
  • Tested with C# and C++
  • Support of Office 2003 & XP
  • Old and new versions are compatible with any language (require the ability to install DLL files for your platform)

Screenshoots

excellink screenshoot

Video Demonstration

Licence

ExcelLink is freeware, so users can embed it anywhere. NO CHARGE.

Installation & Demofiles

Installation may vary by application. DLL files must be placed in an application’s DLL include path or the Windows’ DLL include path; for example, the 64-bit shared library include path is %windir%\SysWOW64. In MetaTrader4 (builds 0600 and below), the library path is %MetaTrader4%\experts\libraries. In TradeStation, the include path is %TSPATH%\Program\.

You may need to enable DLL execution because it's sometimes disabled by default (for security reasons). This tool was released as a DLL, so you’ll need to enable DLL Execution.

Functions

int ExcelStart(str Filename,int Flags)

Here is the first command to start Excel with a given filename. Don’t call this command more than once per code. The filename path must exist, and the current user should have “read/write access” to the directory and its filenames. Function returns an error code. “Code 0” means success. A negative return value means an error has occurred. Double-check the return code before sending additional ExcelLink commands. If you don’t, your Excel link won’t be successful and you’ll be unable to send commands.

Flags indicate how to start Excel:

0 : Start Excel in Default Mode
1 : Enter minimized Mode (to speed things up)
2 : Enable the "Autofit" function

You can use switch multiple flags simultaneously; for example, to start Excel in Minimized Mode and enable autofit at the same time, set the flag parameters to three (2+1). Please note that AutoFit may slow things down.

str ExcelVersion()

This function returns the add-on version of ExcelLink

int ExcelPutValue(int sheet,int Row, int Col, float Value)
int ExcelPutString(int sheet,int Row, int Col, string Str)

These functions are responsible for sending data to Excel. ExcelPutValue can send integers, floats, and double values. ExcelPutString will send a text line to a given cell. Even numbers are sent through ExcelPutString as text. Please note that row, column, and sheet begin at one. First sheet on the table is one; first cell on the sheet is (1, 1). Both functions return zero to indicate success.

float ExcelGetValue(int sheet,int Row, int Col)
str ExcelGetString(int sheet,int Row, int Col)

Read cell contents with these functions. Please note that row, column, and sheet begin at one. First sheet on the table is one; first cell on the sheet is (1, 1). Both functions return zero to indicate success. In addition, please read descriptions on the functions ExcelFreeString() and ExcelGetCalc().

str ExcelCell(int Row,int Col)

This function calculates both row and column coordinates using standard Excel Format; for example, [row one, column one] is the “A1” Excel coordinate. This function is used for ExcelPutCalc functions. (Please read the description on ExcelFreeString function)

int ExcelPutCalc(int sheet,int Row, int Col, str Content)

Using this function allows Excel to calculate values within cells (supports all Excel internal functions). Please read the ExcelGetCalc() function description. You may also want to check out the demonstration codes below to answer any questions.

str ExcelGetCalc(int sheet,int Row, int Col)

If you used ExcelPutCalc on a cell, then you’ve already calculated or manipulated something. To view the result of that calculation, you can use the function ExcelGetCalc; for example, if you use ExcelPutCalc(...,"=A1+A2") and read the same cell with ExcelGetString, you’ll receive the formula "=A1+A2." However, if you read same cell with ExcelGetCalc(...), you’ll receive only the result. Calculations containing string values will give you the result in string values. If you want an integer or a double, you’ll need to convert string values into either integers or doubles manually. This function doesn’t perform autotype casting; thus all results will return as string values.

int ExcelSheetRename(int sheet,str NewName)

This function renames only the existing sheet. Please note that the first sheet is numbered 1.

int ExcelFormatCellColor(int sheet,int Row, int Col, int FrontColor, int BackGroundColor)
int ExcelFormatCellFontSize(int sheet,int Row, int Col, int size)
int ExcelFormatCellFont(int sheet,int Row, int Col, int format)

These functions format the color of a cell, font style, and font size. FrontColor and BackGroundColor are compatible with TradeStation. Basically, red indicates red; green indicates green; and so on. Font size can be between one and one hundred. Formatted texts have the following flags:

0 : Solid, unformatted
1 : Bold
2 : Italic
4 : Underlined

It's possible to indicate more than one format simultaneously; for example, if you want a cell to be bold and underlined, then your format code should be 1 + 4 = 5

int ExcelSaveFile(str Filename)

This function should be used only when the code is complete. Don't call it too often or else you’ll experience lag. This function will store the file under a filename. Remember: The filename path must exist, and the user should have permission to read/write the directory and its filenames. Be careful, though. ExcelLink won’t ask whether you want to overwrite an existing file; it simply won’t provide a confirmation. Typically, you should save the file in ExcelStart. ExcelSave will save all changes from your script. The ExcelStart function loads the filename to Excel. If you want to save changes for next time, use this function.

int ExcelEnd()

The following functions of ExcelLink are asynchronous: ExcelPutValue, ExcelPutString, ExcelPutCalc, ExcelFormatCellColor, ExcelFormatCellFontSize, and ExcelFormatCellFont. These functions will be executed in a separate thread to prevent delays in your code. Be careful, though. If your code stops or exits before an asynchronous command is properly executed in Excel, you may end up with unusable results. If you experience issues with formatting or anything related to an asynchronous command, you must use the ExcelEnd() function before exiting; for example, in MetaTrader, you’ll enter the function Deinit(). In TradeStation, you won’t need the aforementioned function since there’s no command that can end an execution before the completion of an asynchronous command.

int ExcelAutoFit(bool)

This function can enable and disable Excel’s “AutoFit” function. AutoFit is a slow asynchronous feature, so use it carefully on big loops.

int ExcelFreeString(str)

This function is Excel’s multithread-safe attribute. Sometimes you’ll call ExcelGetString and ExcelCell and, as a result, receive a set of string values. These values will then be stored in the memory so that they can be used elsewhere in the code. Of course, things may slow down once the memory has accumulated thousands of iterations. To release the memory, use the function above (only after using ExcelGetString and ExcelCell). Typically, the memory will release after the study self-terminates. You should release the memory if you’ve been running the study for a long time or continuously calling these two functions. Small codes won’t require it; however, larger codes and continuously running codes will.

int ExcelClose()

This function closes active Excel workbooks. In newer versions of Excel, there may be multiple workbooks within the same application. This function won’t close the application, so you won’t have to worry about any open tables or workbooks. Nonetheless, before closing you should save workbooks with the ExcelSave() function. ExcelClose() doesn’t save automatically; it also ignores Excel’s warnings. At the end of your code, call this function. Why? Because you won’t be able to send Excel commands until this function is finished and you’ve already closed the handle to Excel. To continue working with Excel, start with the ExcelOpen() function again and proceed to open a new handle.

Demonstration

Demo #1

Demo #2 (MQL)

Demo #3 (MQL)

Technical Notes

USE EXCELLINK AT YOUR OWN RISK. If you don’t use ExcelLink correctly, it may destroy your existing tables and files. Please report all bugs so that we can address them in the next update. In addition, when sending us information, please don’t forget to include your trading platform, version, operating system, memory, number of screens, and—if possible—a sample of the code.

If you have multiple Excel instances open, ExcelLink may not find correct window. We are still working on this issue.

Important About DLL Versions

We provide you two different version of DLL. Versions differ by how strings and managed internally. ANSI version is the traditional version and UNICODE is new unicode version. ExcelLink can be used from different platforms, depending on platform you will need to use proper version. For example Metatrader build < 520 requires ANSI version but > 520 requires UNICODE. Tradestation requires ANSI version etc. Ask your platform support about DLL string handing scheme to make sure you are using correct version.

If you have multiple Excel instances open, ExcelLink may not find correct window. We are still working on this issue.

Downloads

Version Description Download
4.0
  • Includes 64 bit version
  • Includes 32 bit version
  • Includes Unicode Version
  • Includes Ansi Version
  • All in one package. We have now renamed files as excellinkA for ANSI DLL, excellinkW for UNICODE DLL, excellinkA64 for ANSI 64bit etc. Refer README file inside to choose right DLL. ExcelLink is available to all possible windows platforms now.
Download v4.0 (Bundle)
3.7
  • ExcelLink is now compatible with Metatrader Build >520. This is Unicode version of DLL
  • Unicode version only! Use Ansi Version for software like MultiCharts,Tradestation,NinjaTrader
Download v3.7 (for Metatrader Build >520)
3.6
  • New function ExcelAutoFit implemented to disable "AutoFit" function
  • Bug in ExcelCell fixed.
  • Stable version
  • Use this version for MT4 Build <=520 and any other Software which supports ANSI Strings, for example Tradestation
Download v3.6 (for Metatrader Build <=520)
3.5
  • "Autofit" function default is off
-
3.4
  • Added ExcelClose function
  • Added ExcelGetCalc function
-
3.2
  • Multithread-safe version
  • Added ExcelEnd function
  • Added ExcelFreeString function to release memory
-
2.11
  • First release version
-