Skip to content
All library documents

Building Bidirectional Trading EAs with the HedgeTerminal API

Article MQL5 articles

Summary

This article explains how MQL5 programs can integrate with the HedgeTerminal API to select, inspect, modify, and close bidirectional positions. It describes installing the library, using its transaction and property functions, submitting trade requests, handling errors, and choosing synchronous or asynchronous operation. The API also exposes calculated position details, such as deal counts and slippage, through properties that would otherwise require matching and analyzing transactions.

The article further introduces asynchronous order handling and multithreaded programming, with examples involving Expert Advisors and a quote collector. Its evidence consists of API explanations, implementation examples, and a sample trading EA rather than strategy performance tests. The material is intended for experienced MQL5 programmers and focuses on software integration and position management; it does not establish that bidirectional trading or any example strategy is profitable.

Key ideas

  • Expert Advisors can use HedgeTerminal functions to select transactions and access position, order, and deal properties.
  • The API supports modifying and closing bidirectional positions through trade requests.
  • Error codes and task status functions help programs monitor the outcome of trading actions.
  • The article distinguishes synchronous and asynchronous order submission and discusses multithreaded interaction.
  • API examples explain integration and operation but provide no evidence of trading performance.

Tags

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.