MetaEditor first‑time setup
MetaEditor 5 is the code editor and MQL5 compiler built into MetaTrader 5. It's where you write or paste MQL5, press Compile, and turn a text file into an Expert Advisor, indicator or script that MT5 can run. Open it with F4 from the terminal. This page is the overview; the focused guides below each cover one job end to end.
Start here
- How to open MetaEditor in MT5: F4, the Tools menu, the IDE button, and what to do when F4 does nothing
- Downloading and installing MetaEditor 5: there's no standalone download; it ships with MT5
- Compiling MQL5 from the command line:
metaeditor64.exe /compile, the flags, and build scripts
What is MetaEditor?
MetaEditor is where you write, paste, and compile MQL5 code for MT5. It produces scripts, indicators, or expert advisors you can run in the terminal.
- Open MetaEditor from MT5 via Tools → MetaQuotes Language Editor, or press F4.
- In MetaEditor, you can create a new file (File → New) or open an existing one.
- Paste your code into the editor pane and click the Compile button.
- If compilation succeeds, your compiled file will appear in the Navigator inside MT5 under the correct category (Scripts, Indicators, or Expert Advisors).
What the window looks like
MetaEditor opens as its own window, separate from the MT5 terminal, laid out in three parts:
- Navigator (left): the
MQL5folder tree:Experts,Indicators,Scripts,Include,Files. - Editor (centre): the code, with syntax highlighting and one tab per open file.
- Toolbox (bottom): the Errors tab lists compile errors and warnings with clickable line numbers, alongside the Search and MQL5 community tabs.
The toolbar across the top carries Compile (F7), New (Ctrl+N) and the debugger controls. If you've used any modern IDE the layout will be familiar; the only MT5-specific part is that the Navigator tree mirrors your terminal's data folder on disk.
Where compiled files go
- Scripts compile to
MQL5/Scripts - Indicators compile to
MQL5/Indicators - Expert Advisors compile to
MQL5/Experts
You can see these folders in the MetaEditor Navigator and in MT5’s Navigator.
Troubleshooting
- Can't log in: verify server (Demo vs Real) and credentials.
- No servers listed: close and reopen MT5, or use your broker's installer.
- F4 does nothing: use Tools → MetaQuotes Language Editor instead (see how to open MetaEditor in MT5).
- Compile errors: check the Messages pane in MetaEditor for exact error lines.
- Can't find compiled file: confirm you compiled the correct type and look under the matching folder in Navigator.
Next Steps
- Paste your generated code into MetaEditor and click Compile.
- In MT5, refresh the Navigator if needed, then run the script/attach the indicator or EA to a chart.
- Prefer a demo account while experimenting.
MetaEditor guides:
- How to open MetaEditor in MT5: every way in, plus the Navigator → Modify route
- Downloading and installing MetaEditor 5: Windows, macOS, Linux, and MT4 vs MT5
- Compiling MQL5 from the command line: mass compilation and CI builds
Build and Test:
- MT5 Default Template: Understand EA code structure
- MT5 Backtesting Guide: Test your EAs
- Create Trading Bot MT5: Build EAs without coding
- Automate Trading on MT5: Complete automation guide
Learn MQL5:
- MQL5 vs Pine Script: Compare platforms
- Pine Script vs MQL5: Which to Learn: Choose your path
- Convert Pine Script to MT5: Port TradingView strategies
Related Guides:
- Setting Up MetaTrader 5: Install MT5 first
- Getting Started with HorizonAI: Generate MQL5 code
- MT5 Trading Journal: Track your performance