Skip to content
All library documents

MQL5 Predefined Variables, Functions, Operations, and Control Flow

Article MQL5 articles

Summary

This beginner tutorial introduces MQL5 concepts used when building scripts and Expert Advisors. It explains predefined variables such as the current symbol, chart period, price precision, and minimum price increment, and shows how these values can inform instrument-aware calculations, including stop placement. It also surveys common functions and arithmetic, relational, and logical operations before introducing control flow statements such as loops.

Examples illustrate how predefined values can be printed or used in calculations, and how a loop repeats an action over a fixed range. The article is an introductory programming guide rather than a trading strategy or performance study. Its explanations are simplified, and the provided examples do not establish that a trading rule is profitable or adequately tested. It signals that further articles will cover Expert Advisors and historical testing in more depth.

Key ideas

  • MQL5 predefined variables expose the active symbol, chart timeframe, decimal precision, and minimum price increment.
  • Instrument-specific precision and point size can inform price calculations such as stop-loss placement.
  • Common functions and basic arithmetic, comparison, and logical operations are building blocks for automated trading programs.
  • Control flow statements let an Expert Advisor make decisions and repeat actions.

Tags

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