• Overview
  • Reviews
  • Comments (41)
  • What's new


Trade in the opposite directions with HedgeTerminalApi library!

HedgeTerminalApi is a program interface allowing you to use HedgeTerminal virtualization technologies in your robots and scripts. With HedgeTerminalApi, you are able to trade in the opposite directions when two or more trading algorithms occupy opposite positions on a single symbol. The library allows robots to track their positions even if these positions overlap entirely or partially. Moreover, with this library, you are able to connect your robots to HedgeTerminalUltimate visual panel. The library displays the actions of your robots and their oppositely directed positions in real time rising your work to the new level.

HedgeTerminalApi is not a loose collection of functions or a separate solution for a narrow range of tasks. HedgeTerminalApi is a convenient programmic access to powerful virtualization technologies implemented by all products of HedgeTerminal series. The library provides your business processes with the reliable virtualization and multidirectional trading technologies. It can be used for the development of complex trading systems consisting of the plenty of independent elements. 

HedgeTerminalApi has many beneficial features:

  • Reliability. This was the key feature when developing the software architecture. HedgeTerminal contains thousands of source code lines. The ultimate objective of the most of its codes is ensuring reliability. Since HedgeTerminal is a specialized infrastructure solution, its overall reliability level is crucial to its success. That is why HedgeTerminal compares favorably with custom solutions. In order to develop a solution of a similar level, a user would have to develop infrastructure algorithms exceeding the size of the trading code itself dozens of times.  
  • The ability to connect to HedgeTerminalUltimate panel. If you have purchased HedgeTerminalUltimate visual panel, you can use it to track the status of your trading robots. Moreover, this panel allows you to do the following things on the fly without the need to re-launch your algorithms: place or change stop loss or take profit levels, forcefully close positions of your Expert Advisors, analyze results of your trading robots in real time and on history in the convenient and modern table of positions.
  • Using on remote VPS and simultaneous work on different computers. Major part of the data used for virtualization is derived from the information about an account, its trades and orders. This means that your library copies can see each other's positions and manage only their parts of positions regardless of where and in what quantity they have been launched, provided that they are connected to a single account. For example, you can install the virtualization library with your robots on a remote VPS and monitor their activity from your home PC via HedgeTerminalUltimate that displays the status and positions of your algorithms in real time.
  • Simplicity and functionality. The library API resembles the syntax of MQL5 system functions. If you know this programming language, you can easily make sense of the library API. For example, the analog of HistoryDealSelect function in HedgeTerminalApi is HedgeDealSelect, while the analog of OrderSelect function is HedgeOrderSelect. Moreover, while MQL5 grants access to order and deal properties as if they were unrelated transactions, the program interface of HedgeTerminal arranges more high-level access to that data. For example, using its API, you can select the necessary position and find out what orders it includes and what trades that orders consist of. Besides, positions, orders and trades provide advanced properties that are not available in MQL5 directly. For example, you can find out the price the order/position was actually executed at, or receive the position slippage value.
  • Free use in the test mode. You can develop and test the robots using virtualization technologies for free. You do not have to purchase the license to use the library in test mode. Develop robots to order and test the technology for free.
  • Features. If you are an advanced trader having HedgeTerminalUltimate, its features may not be enough for you. If you want to automate your trading, create your own report system based on HedgeTerminal, use complex position tracking methods or apply some other things, HedgeTerminalApi can be extremely useful. It has well-developed API allowing you to access even the values and the properties not displayed in HedgeTerminalUltimate. Besides, API functions allow you to use complex position tracking that is limited or unavailable in the panel.

How to start using the library right now? Comments section contains detailed instructions for installing HedgeTerminalApi. The video on installing and using HedgeTerminalApi is to be provided soon.

No reviews
Version 1.19 - 2016.06.27
- Fixed the application crash, which sometimes occurred when attempting to download data from XML files of the HedgeTerminal settings. Compilation is performed for the MetaTrader build 1347 from June 17, 2016.
Version 1.18 - 2016.06.13
- The new version 1.18 is built for latest version of the MetaTrader 5 (build 1340 of May 13, 2016). The previous versions could cause runtime errors and crash the terminal in certain cases. The new build fixes those issues.
Version 1.17 - 2016.03.10
All products:
- Fixed freezing error. This error occurred when trying to close a position with a preset stop loss, provided that the closing command also contained a comment.
- Fixed the error that in some cases caused an infinite call to the position update procedure (infinite recursive loop).
- Fixed the profit calculation for some of the forex instruments. Now the profit is calculated correctly for the instruments such as gold.
- Fixed the input of the new Take-Profit value. Now an incorrect value can not be entered in the Take-Profit column (it simple will not be set).
Version 1.16 - 2015.11.18
All products:
- The series of HedgeTerminal products has been successfully tested on the largest Brazilian Stock Exchange Bm&fBovespa. The products now support bi-directional trading with Bm&fBovespa.

- Outgoing comments are now saved and loaded using global variables.
- Fixed the error, when HedgeTerminal failed to start on the accounts of brokers whose names contained symbols inappropriate for file name.

HedgeTerminal Panel Demo:
- The demo version of the panel works now with the AAPL* instrument.

- If a comment is changed in one panel window, the change is now displayed in other running windows of the panel. This didn't work in the previous versions.
Version 1.15 - 2015.11.11
All products:
- Fixed error, due to which an actually closed position was perceived by HedgeTerminal as a still open bi-directional position.
- Trade operation processing speed has been greatly improved. The lags that could happen in previous versions have been eliminated.
- Now HedgeTerminal stores additional information about active positions in global variables. This has significantly improved trade logic processing speed and simplified interaction between terminals and HT applications.

- Fixed display of icons in the Asia region. Now all icons and characters appear the same regardless of the current encoding settings.
Version 1.11 - 2015.10.23
All products:

Fixed an error that could occur, if the stop order that implements the Stop Loss level got expired for some reasons. In the previous versions this stop level could freeze, and working with stop-levels of bi-directional positions was impossible. In the new version this situation is handled like cancellation of a stop order: protective stop levels are reset in this case.

Fixed check of the total net position between HedgeTermianal and MetaTrader 5. This check could sometimes lead to an untrue message that the positions are not equal. Now, if there is a mismatch, messages are printed to the terminal log instead of the MessageBox. The error message has been expanded: details of the mismatch are also shown.


Additional icons are available in the new MetaTrader 5 versions: Depth of Market and Trade Panel. To avoid overlapping, the HedgeTerminal menu button has been moved to the right.
Version 1.10 - 2015.08.27
All products:
- Fixed removing stop loss orders during clearing when trading on FORTS. Now, all pending orders placed by HedgeTerminal are active up to their expiration time or indefenitely (on other markets).
Version 1.9 - 2015.08.21
All products:
- Fixed calculation of financial result for some FORTS futures (RTS, ED, GOLD) in terminals of some brokers. Now the cost of a point of these instruments is correctly calculated.
- Fixed the zero division error occurred if the trading instrument was not found in the history.
- New item in the panel settings: "Hide Hedge Positions". If all active positions make a complete hedge (or a lock), they can be hidden. Thereby, they are considered to be closed by HedgeTerminal and EAs which use the virtualization library. As actually positions are not closed, hidden positions do not require commissions and are not subject to slippage. But hidden positions are absent on the History tab and their financial result is not taken into account.
Version 1.8 - 2015.05.26
All products:
- Fixed calculation of the financial result for some FORTS futures (RTS, ED, GOLD). Now it conforms to the price step for the futures.
- Now HedgeTerminal correctly handles rollover of futures positions in MOEX. In earlier versions, specific rollover deals were not handled and were not deleted from the HedgeTerminal environment, which could lead to memory leaks.
- Position change is displayed in the panel faster in some cases.
Version 1.7 - 2015.04.10
All products:
- HedgeTerminal now correctly displays active positions on the accounts of the brokers who carry classical position rollover using conversion transactions (when positions are reopened at the time of rollover or clearing).
Version 1.5 - 2015.03.25
For all products:
- The new MetaTrader 5 version build 1090 and higher features a significantly higher order and deal parsing speed. Now parsing 20,000 orders and 20,000 deals with the i7 processor takes about 6-8 seconds. In previous versions the same parsing took 23-25 seconds.
- Fixed error, which cased part of table rows to get behind the table in the tabs area following panel resizing.
- Tooltip added for columns EntryDate and ExitDate. It helps to define the position entry and exit time when the full date does not fit into the column.
- All source codes provided with the library have been revised. Some older versions of the Chaos2.mqh EA have been fixed. Now it uses the new version Prototypes.mqh and compiles without warnings and errors.
Version 1.4 - 2015.02.16
- Changed the prototype file. ENUM_TRANS_DIRECTION enumeration has been replaced with ENUM_DIRECTION_TYPE. Added IF_LONG, IF_SHORT, IS_FROZEN and FOREACH_POSITION substitutional macros.
- Fixed minor errors in HedgeTerminalAPI.
Version 1.3 - 2015.01.29
All products:
- Added the progress bar. Now, the loading status can be seen in a small graphical window. The bar is displayed both for the panel and for HedgeTerminalAPI.
- The chart is now specially prepared for the table before the download. After uploading the EA, the previous chart state is restored. Now, the panel looks more attractive.
- Fixed Margin values. Now, it displays an actual margin load level from 0 to 100%.
- Added seconds to Entry Date and Exit Date columns.
Version 1.2 - 2015.01.22
- Fixed bad grammar in messages and dialogs.

- Updated Prototypes.mqh prototype file.
Version 1.1 - 2014.12.10
- Fixed entering the continuous loop if the new take profit level is similar to the old take profit's one.
- Fixed crash when setting the position volume exceeding the current one.
- Increased the speed of order and deal parsing by 7-10%.
- Fixed some installer bugs.

- Fixed display of positions. Now, displayed positions are sorted by their IDs from the smallest to the largest one.
- Fixed demo panel errors.


- Fixed processing ENUM_CLOSE_TYPE modifier when closing a position via an Expert Advisor.
- Added ENUM_POSITION_STATE enumeration displaying the current position status.
- Added ENUM_HEDGE_PROP_INTEGER enumeration defining a modifier of one of HedgeTerminal properties.
- Added HedgePropertySetInteger function setting one of HedgeTerminal properties.
- Added HedgePropertyGetInteger function receiving one of HedgeTerminal properties.
- Fixed ENUM_HEDGE_ERR error activation in case a stop loss level is modified.
- Added Chaos2 Expert Advisor to the standard delivery.
- Removed HedgeMAExpert Expert Advisor from the standard delivery.