Loading…

Terminal Info Helper

The terminal exposes connection status, trade-allow toggles, build number, ping, memory and installation paths through a handful of generic functions keyed by an enum constant - TerminalInfoInteger(TERMINAL_CONNECTED) and its relatives. Calling one of these correctly is trivial; the friction is that a genuine support question ("did the EA even try to trade on this machine") usually needs four or five of them read together, and every one of those enum names has to be looked up or remembered. This header gives each property a short, self-explanatory function name, and adds TiSummary() - one line combining company, build, connection state, the trade-allow flags and ping into a single Print() worth putting in OnInit. Printing that line at attach time turns "why didn't it trade" from a guessing game into a fact already sitting in the log before the question is even asked. TiMeetsMinimumBuild() exists for a narrower but real problem: a feature added in a specific terminal build should be gated on that build rather than failing unpredictably on an older one, and TERMINAL_BUILD is the only reliable way to know which build is actually running. This applies identically on both platforms. Notes and limitations - Every value here is read live from the terminal at call time; nothing is cached, so there is no staleness to manage, but calling these in a very tight loop has the same cost as calling TerminalInfoInteger directly. - TiIsTerminalTradeAllowed() and (on MQL5) TiIsAccountTradeAllowed()/ TiIsExpertTradeAllowed() answer different questions - the first is the terminal's global toolbar toggle, the other two are broker-side account permissions. TiSummary() prints all of them because any one being off is a common, easily missed reason an EA never sends an order. - Ping and memory figures depend on the terminal having connected at least once in the session; a fresh, never-connected terminal may report 0 or -1 for TiPingMicroseconds() until the first successful round trip. - Identical on both platforms except where the MQL4 VERSUS MQL5 DIFFERENCES section above says otherwise.

Script · MT5 · v1.0 · Free

About Terminal Info Helper

Terminal Info Helper is a script for MetaTrader 5. It has 1 setting, such as Minimum build. MQL source code included.

Files in the download: TerminalInfo.mq5.mqh, TerminalInfo.txt, TerminalInfoDemo.ex5, TerminalInfoDemo.mq5.

Settings

SettingDefaultWhat it does
Minimum build1350Build to test TiMeetsMinimumBuild() against

How to install

  1. Download the ZIP from your PolyMaria library and unzip it.
  2. In MetaTrader 5 open File → Open Data Folder, then go to MQL5 → Scripts.
  3. Copy the .mq5 file(s) there. Put any .mqh files in MQL5 → Include.
  4. Open the .mq5 file in MetaEditor and press Compile (F7) if MetaTrader does not show it.
  5. Drag the script onto a chart to run it once.

Download the PDF guide

Tags: MT5 Script · MQL5 Source Code

MQL4 & MQL5 scripts · PolyMaria