Horizon + MetaTrader 5
HorizonAI writes MQL5, the language of MetaTrader 5 Expert Advisors and indicators. There are two ways to work: build in the Horizon platform and export to MQL5 at the end (recommended), or set the script type to MT5 and talk to MQL5 directly. This page gives you the whole picture.
The recommended flow: build in Horizon, export to MQL5
This is the main pipeline, and the best experience for almost everyone:
- Build your strategy by chatting in the Horizon platform. It appears on a live chart with candlesticks as you talk.
- Backtest it right in the chat, with results in seconds. Run multi-market backtests and a stress test to prove the edge is real.
- Export the finished strategy as MQL5 with one click.
- Run it in MetaTrader 5: set up MT5, compile the file, and attach it to a chart.
Talking to MQL5 directly
Prefer to stay in MQL5 the whole way? Set the script type to MT5 (MQL5) in a chat and the AI writes and edits real MQL5. Of the three platform languages, MQL5 has the deepest support inside Horizon, so working directly is genuinely comfortable:
- A live chart, with candlesticks. The Chart tab shows your strategy on real price data, with your indicators drawn and entry and exit markers on the candles.
- One-click backtests, no MT5 install needed. Your Expert Advisor runs on a real MetaTrader 5 terminal in the cloud; the report, equity curve and trade list come back into the chat in about 30 seconds, and the AI reads them to suggest improvements. See One-Click Backtesting.
- Read and edit your existing EAs. Paste or upload an Expert Advisor you already have and iterate on it in plain English.
- Convert from other languages. Turn a Pine Script or NinjaScript strategy into MQL5 with the Converter.
- Download and go. One click gets you the finished file, ready for MetaEditor.
Good to know
- Cloud backtests take about 30 seconds per run and cover 30 symbols: the major and cross forex pairs, plus gold and silver. For stocks, crypto or futures, backtest in the Horizon platform, or in the MT5 desktop app.
- Multi-market backtests and stress testing live in the Horizon platform; build there and export if you want them.
- You don't need MetaTrader 5 installed to build and test. You only need it when you're ready to run the strategy on your own charts; it's free, see Setting up MetaTrader 5.
Getting set up
- Open a chat at app.horizontrading.ai and set the script type to MT5 (MQL5).
- Describe your strategy, or paste in an EA you already have. Use the Chart tab to watch it and the Backtest tab to test it, all in the browser.
- When it's ready, install MetaTrader 5 (free) to run it on a demo or real account.
New to MetaTrader 5?
Most traders meet MT5 for the first time through Horizon. The MetaTrader 5 tips section in the sidebar covers the platform itself: MetaEditor (where MQL5 code lives), the desktop Strategy Tester and its optimizer, getting quality tick data, reading the Journal when something misbehaves, and chart templates.
Related Guides
- One-Click Backtesting: cloud MT5 backtests from the chat
- Setting up MetaTrader 5: install MT5 and open a demo account
- Exporting from Horizon: turn a proven Horizon strategy into MQL5
- Convert Pine Script to MT5: bring a TradingView strategy over
- Backtesting in the MT5 Desktop App: the full Strategy Tester, including optimization