MQL5 Expert Advisor Basics: Events, Data Types, Calculations, and Testing
Summary
This beginner video series introduces the structure and basic programming concepts behind a MetaTrader 5 Expert Advisor. It explains initialization, shutdown, and tick events; displays text and values on a chart; and demonstrates common data types, arithmetic, variables, and custom functions. The series also walks through the Strategy Tester, including selecting an instrument, timeframe, test period, account settings, and price modeling options. Examples show how integer division differs from floating-point division and how a function can receive a value and return a result.
The material is educational rather than a trading method: the sample EA prints information and does not generate or execute a tested strategy. Its tester discussion notes that some tick paths may be simulated from bar data, which limits what such a run can establish about real execution. The examples provide a starting point for learning MQL5, but they do not address robust strategy validation, costs, or live-trading risk in depth.
Key ideas
- An Expert Advisor uses lifecycle and tick events to run platform code.
- MQL5 data types determine how text, prices, times, whole numbers, and boolean values are represented.
- Integer division truncates fractional results, so floating-point types are needed for decimal calculations.
- The Strategy Tester runs an EA on historical data, but modeled price paths can limit realism.
- Custom functions organize calculations by accepting parameters and returning values.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.