MetaEditor (MT5)

MetaEditor first‑time setup

Open MetaEditor and compile your first MQL5 script

This guide shows how to open MetaEditor inside MetaTrader 5 (MT5), create a file, paste MQL5 code, and click Compile—everything you need for a first‑time MetaEditor setup.

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.

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.

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.

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