TAG

beginner

  • November 7, 2025

What Is an Expert Advisor

Overview An Expert Advisor (EA) in MQL5 is an automated trading system that runs inside MetaTrader 5. It monitors the market, makes trading decisions, and can execute orders automatically based on your strategy. Unlike scripts, which run once and stop, an EA operates continuously — it reacts to every market tick or event. EAs are written in the same MQL5 language used for indicators and scripts, but they rely on special event-handling functions to process data and react to market updates. What You Will Be Able to Do Code Example Execution Steps Key Point An Expert Advisor is event-driven: OnInit() runs once at startup, OnTick() executes on every market update, and OnDeinit() runs when the EA is removed. This structure makes it ideal for continuous strategy execution, order management, and monitoring. Next Section → Next: The OnTick Function

  • November 7, 2025

Reading Indicator Values

Overview In MQL5, indicator outputs are stored in buffers. You access these buffers programmatically using a handle (e.g., from iMA(), iRSI()) and the CopyBuffer() function. This lets your scripts and Expert Advisors consume analytical data directly for decisions. What You Will Be Able to Do Code Example Execution Steps Key Point Indicator outputs live in buffers. Create a handle, call CopyBuffer() for the desired buffer index and bar range, then release the handle with IndicatorRelease(). Use ArraySetAsSeries(true) when you want buf[0] to represent the most recent bar. Next Section → Next: What Is an Expert Advisor

  • November 7, 2025

What Are Indicators

Overview In MQL5, an indicator analyzes market data and visualizes results on a chart or subwindow. Unlike Scripts and Expert Advisors, indicators do not send orders; they compute values and draw them as lines, histograms, or arrows so you can interpret trends and signals. You can use built-in indicators (e.g., Moving Average, RSI) or create custom ones with MQL5. What You Will Be Able to Do Code Example Execution Steps Key Point Indicators compute and draw values; they do not trade. They are often used as inputs to Expert Advisors or for visual decision support on charts. Next Section → Next: Reading Indicator Values  

  • November 6, 2025

Understanding Print

Overview The Print() function is the simplest way to observe what your MQL5 program is doing. It writes messages to the terminal logs so you can confirm variable values, execution order, and error conditions. Outputs appear in the Experts tab (for Scripts/EAs/Indicators) and also in the terminal’s log files. Using Print() early and often is the fastest path to reliable debugging. What You Will Be Able to Do Code Example Execution Steps Key Point Print() is your primary tracing tool. Log the inputs, intermediate values, and branch decisions that matter. Keep messages short, consistent, and searchable to speed up debugging. Next Section → Next: Getting the Symbol Name

  • November 5, 2025

Your First Script

Overview In MQL5, a script is a simple program designed to perform a single action and then terminate. Unlike Expert Advisors (EAs), which run continuously with every new market tick, a script executes its code only once when launched. Scripts are ideal for quick operations such as sending a message to the log, closing all trades, or performing calculations that do not require constant updates. This section will guide you through creating and running your first MQL5 script. What You Will Be Able to Do Code Example Execution Steps Key Point Scripts always begin execution with the OnStart() function and stop automatically once the code inside it finishes. They are best suited for one-time tasks, such as modifying trade positions, exporting data, or testing short pieces of code. As you progress, you’ll find scripts useful for both learning MQL5 and performing small maintenance operations in your trading workflow. Next Section→ Next: Understanding Print

  • November 4, 2025

What Is MetaEditor

Overview MetaEditor is the dedicated development environment for creating programs in MQL5, the programming language of MetaTrader 5. It is tightly integrated with the trading terminal and provides everything you need to write, compile, and debug trading algorithms. Each MQL5 program—whether a Script, Expert Advisor, Indicator, or Service—is first written as a source file with the extension .mq5 or .mqh, and then compiled into an executable .ex5 file that MetaTrader can run. Unlike a plain text editor, MetaEditor automatically highlights syntax, suggests function names, and helps you find errors during compilation. It is the starting point for any kind of automated system development in MetaTrader 5. What You Will Be Able to Do Code Example Execution Steps Key Point MetaEditor is more than a code editor—it is a full IDE (Integrated Development Environment) for MQL5. It helps you manage projects, compile efficiently, and debug issues before running programs in MetaTrader 5. Becoming familiar with its structure and workflow is the first practical step toward writing reliable trading algorithms. Next Section → Next: Your First Script

  • November 4, 2025

Getting Started with MQL5

Overview MetaTrader 5 is a comprehensive trading platform that allows traders to analyze markets, run indicators, and automate strategies. To make automation possible, MetaTrader includes its own programming language — MQL5 (MetaQuotes Language 5). It is a C-like language designed specifically for trading automation, allowing you to build scripts, indicators, and expert advisors (EAs) that execute trades automatically. MQL5 improves upon its predecessor, MQL4, by introducing object-oriented programming and faster execution, making it a robust choice for modern algorithmic trading. What You Will Be Able to Do Code Example Execution Steps Key Point MQL5 programs are executed within the MetaTrader 5 terminal environment. Each program type serves a distinct purpose — Scripts for one-time actions, Indicators for data visualization, Expert Advisors for automated trading, and Services for background tasks. Together, they form a flexible ecosystem that allows traders to automate nearly every aspect of their strategy. Next Section → Next: What Is MetaEditor