MetaEditor (MT5)

Intro to MetaEditor

Open MetaEditor and compile your first MQL5 script

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.

Most HorizonAI users only meet MetaEditor once: at export. You build and test strategies in the Horizon platform, and MetaEditor is just where you compile the exported MQL5 file before trading it.

Start here

Paste, compile, deploy

  1. Open MetaEditor — F4, or see the four ways in if F4 does nothing.
  2. File → New (or open the exported .mq5), paste the full code, click Compile (F7).
  3. If compilation succeeds, the compiled file appears in MT5's Navigator under Scripts, Indicators, or Expert Advisors.

If you’re just testing that everything works, create a simple script first. Scripts run once on demand; they’re great for quick checks before building a full indicator or EA.

What the window looks like

MetaEditor opens as its own window, separate from the MT5 terminal, laid out in three parts:

  • Navigator (left): the MQL5 folder 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.

Tip: If you see compile errors, double‑check that the file type matches what you intend (Script vs Indicator vs Expert Advisor) and that you pasted the full code.

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