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
- Understand the role of MetaEditor within the MetaTrader 5 ecosystem.
- Recognize the main interface components — the Editor, Navigator, and Toolbox.
- Open and explore the
MQL5data folder directly from MetaTrader. - Create new MQL5 files using the built-in Wizard.
- Compile your program and locate the generated
.ex5file in its proper folder.
Code Example
//+------------------------------------------------------------------+
//| SampleEA.mq5 |
//+------------------------------------------------------------------+
#property version "1.00"
#property strict
int OnInit()
{
Print("Expert Advisor initialized.");
return(INIT_SUCCEEDED);
}
void OnDeinit(const int reason)
{
Print("Expert Advisor stopped.");
}
void OnTick()
{
// Called on every new tick
}
Execution Steps
- Launch MetaEditor from MetaTrader 5 (press F4 or click the MetaEditor icon).
- Select File → New to start the MQL5 Wizard.
- Choose Expert Advisor (template) and enter a name such as
SampleEA. - Click Finish to generate the template code shown above.
- Press F7 to compile. A message “0 error(s), 0 warning(s)” should appear in the Toolbox panel.
- Confirm that the compiled file
SampleEA.ex5has been created inMQL5/Experts/.
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


