Backtesting in HorizonAI
HorizonAI ships with a built-in MT5 backtester. Whatever MQL5 strategy the AI writes for you can be tested against a year (or more) of real market data with one click — right inside the chat. Your code runs on a real MetaTrader 5 terminal in the cloud, and the AI can read the results and suggest improvements.
What it is
HorizonAI's backtester runs your MQL5 Expert Advisor on a real MT5 terminal in the cloud and returns the same metrics MetaTrader's Strategy Tester would — net profit, profit factor, Sharpe, max drawdown, win rate, an equity curve, and a trade-by-trade breakdown — directly in the chat panel.
Because it's running real MQL5 (not an emulation), anything the AI writes for MT5 — moving averages, RSI, MACD, Bollinger Bands, Ichimoku, custom logic — works as it would in MetaTrader.
1) Open a chat and build (or paste) a strategy
- Go to app.horizontrading.ai and open or create a new chat.
- Make sure the script type is set to MT5 (MQL5) — Pine Script strategies aren't supported by the backtester.
- Describe the strategy you want, e.g. "EMA 20/50 crossover EA with a 2× ATR stop and 3× ATR take profit." The AI writes the EA and shows it in the Code panel on the right.
2) Open the Backtest tab
In the right-side panel, switch from Code to the Backtest tab. You'll see:
- A Symbol dropdown
- A Timeframe dropdown
- A Run button
- (Pro/Elite) From and To date inputs for a custom window
If your EA defines input parameters (lot size, periods, stop multiples, etc.), an Inputs button lets you edit them before running.
3) Pick a symbol and timeframe
Supported symbols (30 total):
- Forex majors — EURUSD, GBPUSD, USDJPY, USDCHF, USDCAD, AUDUSD, NZDUSD
- EUR / GBP / AUD / CAD / NZD / CHF crosses — EURGBP, EURJPY, EURCHF, EURCAD, EURAUD, EURNZD, GBPJPY, GBPCHF, GBPCAD, GBPAUD, GBPNZD, AUDJPY, AUDCHF, AUDCAD, AUDNZD, CADJPY, CADCHF, NZDJPY, NZDCHF, NZDCAD, CHFJPY
- Metals — XAUUSD (Gold), XAGUSD (Silver)
The dropdown is searchable — start typing a pair to filter.
Supported timeframes: M1, M5, M15, M30, H1, H4, D1, W1.
4) Click Run
Hit Run. A typical backtest finishes in about 30 seconds — but if the global queue is busy you'll see your position in line. You can keep chatting with the AI while it runs.
By default, the backtest covers the last 12 months. Pro accounts can pick any 2-year window; Elite goes back up to 10 years.
5) Read the results
When the run finishes, the panel shows three views:
- Report — a clean Strategy Tester report: net profit, gross profit/loss, profit factor, expected payoff, Sharpe ratio, recovery factor, balance and equity drawdown (dollar and %), total/winning/losing trades, long vs short breakdown, max consecutive wins/losses.
- Trades — a sortable table of every trade: entry time, exit time, direction, entry/exit price, duration, P&L.
- Chart — the price candles with green entry markers and red exit markers, plus the equity curve below.
Above the panel you'll also see a row of pills showing your previous backtests in this chat — click any one to bring its results back up.
6) Improve the strategy with the AI
This is where the in-app backtester earns its keep. Once a result is in front of you, just ask the AI things like:
- "Why is the win rate so low on shorts?"
- "Try a tighter stop — what changes?"
- "Add a session filter so it only trades London hours."
The AI can read the metrics, the trade list, and your EA code together. It will edit the EA and offer to run a new backtest.
Limits, defaults & fine print
- Initial deposit: $10,000 (fixed)
- Commission: 0.1% per trade
- Slippage: not modeled
- Fill model: orders fill at the close price of the bar
- Modeling: 1-minute OHLC (real MT5 data, downloaded from MetaQuotes-Demo)
- One run at a time per user — wait for your current backtest to finish before queuing another.
- Free trial: 5 backtests total, H4/D1/W1 only, fixed 12-month window.
- Pro: unlimited backtests, all timeframes, custom date ranges up to 2 years back.
- Elite: same as Pro, custom ranges up to 10 years back.
- Timeout: runs that don't finish within 15 minutes are marked failed.
When to use this vs. the MT5 Desktop Strategy Tester
| Use HorizonAI's in-app backtester when… | Use the MT5 Desktop Strategy Tester when… |
|---|---|
| You want a quick read on whether the AI's strategy is even worth keeping | You want to optimize input parameters (genetic / brute-force sweeps) |
| You don't have MT5 installed or are on a Mac/Linux machine | You want walk-forward or multi-pass analysis |
| You want the AI to read the result and iterate with you | You want to backtest with your broker's actual tick data and spread |
| You're testing forex or metals | You're testing instruments outside the supported forex / metals list |
Many users do both: iterate fast in HorizonAI to find a strategy that holds up, then move the EA to the MT5 desktop platform for deeper optimization. See Backtesting in the MetaTrader 5 Desktop App for that workflow.
Troubleshooting
- "Indicators can't be backtested" — your code has
#property indicator. Ask the AI: "convert this indicator into an EA that trades on its signal." - "No trades" — your entry conditions never triggered in the test window. Widen the date range (Pro/Elite), pick a more volatile symbol (XAUUSD is a good stress test), or loosen the conditions.
- Stuck in the queue — the worker runs one backtest at a time globally. Most queues clear in under a minute.
- Timeframe locked with "(Pro)" — you're on the free trial. Upgrade to Pro to unlock M1–H1.
- First run on a symbol feels slow — the first time a symbol is touched, MT5 downloads its history. Subsequent runs on the same pair are faster.
Understanding Your Results
- Backtesting Metrics Explained — Profit factor, Sharpe, drawdown, expected payoff
- How to Backtest a Trading Strategy — Validation best practices
- Common Backtesting Mistakes to Avoid — Curve-fitting, look-ahead bias, and other traps
Related Guides
- Backtesting in the MetaTrader 5 Desktop App — Use MT5's built-in Strategy Tester for optimization
- Quickstart — Build your first MT5 strategy with HorizonAI
- How to Talk to Horizon AI — Prompt tips for better strategies
- Setting Up MetaTrader 5 — Install MT5 to run your EA live
- Introduction to MetaEditor — Compile and edit your MQL5 code