MQL4 (MetaQuotes Language 4) is a built-in programming language for developing automated trading strategies, custom technical indicators, scripts, and libraries for the MetaTrader 4 trading platform. Developed by MetaQuotes Ltd., it facilitates automated trading management and strategy implementation.

**Program Types & Storage:**

  • **Expert Advisors (EAs):** Mechanical trading systems linked to a chart. Triggered by events: initialization, deinitialization, new tick, timer, depth of market change, chart event, custom events. Can automate trading or provide trade alerts. Stored in terminal_directory\MQL4\Experts.
  • **Custom Indicators:** Independent technical indicators for analytical functions only. Cannot trade automatically. Stored in terminal_directory\MQL4\Indicators.
  • **Scripts:** Programs for single execution of actions. Only process the start event (OnStart handler). Stored in terminal_directory\MQL4\Scripts.
  • **Libraries:** Sets of custom functions for reuse. Cannot execute independently. Stored in terminal_directory\MQL4\Libraries.
  • **Include Files:** Source text of frequently used code blocks. Can be included in EAs, scripts, indicators, and libraries at compile time. Preferred over libraries due to reduced overhead. Stored in the same directory as the source file (using #include "file.mqh") or in terminal_directory\MQL4\Include (using #include )
  • **Development Environment:**

  • **MetaEditor:** A text editor with syntax highlighting for MQL4 code, aiding navigation and development.
  • **Core Functionality:**

  • Analyzes current and historical quote data.
  • Includes built-in technical indicators.
  • Provides functions for managing and controlling trade orders.
  • **Language Features:**

  • Covers functions, operations, reserved words, and language constructions categorized for easy reference.
  • Supports MQL5 features (link provided).
  • **Resources:**

  • MQL4 Reference documentation.
  • MQL4 Help file (CHM format) available for download in English and Russian.
  • Links to MQL5 features, language basics, constants, enumerations, structures, predefined variables, common functions, array functions, conversion functions, math functions, string functions, date/time functions, account information, market information, timeseries/indicator access, chart operations, trade functions, trade signals, global variables, file functions, custom indicators, object functions, technical indicators, event functions, and obsolete functions.
  • **Platform:**

  • MetaTrader 4 (MT4) trading platform.