MetaEditor (MT5)

MetaEditor first‑time setup

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

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.

  1. Open MetaEditor from MT5 via Tools → MetaQuotes Language Editor, or press F4.
  2. In MetaEditor, you can create a new file (File → New) or open an existing one.
  3. Paste your code into the editor pane and click the Compile button.
  4. If compilation succeeds, your compiled file will appear in the Navigator inside MT5 under the correct category (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

  • 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:

Build and Test:

Learn MQL5:

Related Guides: