Building in Horizon

Backtesting in Horizon

Run a strategy against real market data without leaving the chat

Every strategy you build in Horizon can be backtested against real market data, right in the chat, with results back in a couple of seconds. You don't even have to ask: the AI backtests a strategy itself after writing or changing it and reads the numbers straight back to you. The first run on a new strategy is usually a multi-market backtest across a whole basket of instruments.

This guide covers the Horizon backtester, the default one. If you're talking to a platform language directly: for MQL5 see Backtesting MT5 Strategies in HorizonAI; for Pine Script see Backtesting Pine Script Strategies in HorizonAI.

1) Build a strategy, not an indicator

An indicator draws on the chart but never trades, so there is nothing to backtest. A strategy has entries and exits.

  1. Open a chat at app.horizontrading.ai.
  2. Ask for a strategy, e.g. "Go long when the 20 EMA crosses above the 50, exit on the reverse cross, 2% stop and 3% target."
  3. The AI builds it and backtests it on its own, without being asked.

If the run comes back with "there is nothing to backtest", you've built an indicator. Just say: "turn this into a strategy with entries and exits."

2) Open the Backtest tab

In the right-side panel, switch from Code to Backtest. The controls row holds the sub-tabs (Overview, Report, Trades, and Stress test), the market picker, the timeframe picker, the date range, and the Run button.

Market and timeframe are the same pair the Chart tab uses; change them in either place and both follow.

3) Pick a market and timeframe

The market box opens on a curated list and searches a much wider universe as you type:

  • Forex: EUR/USD, GBP/USD, USD/JPY, USD/CHF, AUD/USD, USD/CAD
  • Commodities: XAU/USD (Gold), XAG/USD (Silver)
  • Crypto: BTC/USD, ETH/USD, SOL/USD, DOGE/USD, AVAX/USD, LINK/USD
  • Stocks: AAPL, MSFT, GOOGL, AMZN, TSLA, NVDA, META
  • Futures: ES1!, NQ1!, GC1!, CL1!

Timeframes: 1m, 5m, 15m, 30m, 1h, 4h, 1D.

By default a run tests roughly the most recent 1,000 bars, with the newest 250 bars held back as unseen data. The Report tells you exactly how many bars were tested. Want a specific period? Set the date range in the controls, or just say it: "backtest this on 2020 to 2023."

4) Click Run, or just ask

Hit Run and most results land in a few seconds.

Let the AI run it for you. Say "backtest this" and it picks a market and timeframe, runs it, and quotes the return, win rate, profit factor, drawdown and trade count back in the same reply, then offers a change. "Backtest this and tell me what's wrong with it" is a single message.

5) Read the results

Three sub-tabs:

  • Overview: the read-at-a-glance view. Net profit, return, profit factor, win rate, max drawdown, trade count, a long-vs-short split, how trades ended, and the equity curve.
  • Report: the formal, exhaustive version. Gross profit and loss, expectancy, average and largest win/loss, consecutive wins and losses, trade durations, monthly returns, the P&L distribution and a drawdown-over-time chart.
  • Trades: the price chart with your entries and exits marked on it, above a sortable table of every closed trade: direction, entry and exit time and price, duration, P&L, and why it closed (stop, target, signal, or end of data).

There's a fourth sub-tab, Stress test: six checks that tell you whether the numbers above are real or luck. It gets its own page.

Past runs stack up in a history strip so you can flip between markets and versions. The runs from a multi-market backtest sit grouped together in a box labelled Batch.

Exports: the Report header has a JSON button for the whole result; the Trades tab has a CSV button for the trade list.

6) Iterate

The AI can see the metrics, the trade list and the strategy at the same time, so ask it directly: "why is the drawdown so deep?", "try a wider stop", "does it still work on gold?" It makes the change and offers to run it again.

How to read the numbers

  • Starting capital is $10,000 with a small commission modelled on every trade. Real spreads, slippage and broker fees will differ, so treat the report as a check on your logic, not a forecast.
  • One position at a time. A new entry only fires when the previous trade has closed.
  • An open position at the end of the data is closed automatically and shows in the trade list with an "end of data" reason.
  • A tiny number of trades proves nothing, even when every one wins. The stress test checks this for you.

Past performance does not guarantee future results. A backtest is a sanity check, not a promise.

Plans

The manual Run button is on Pro and Elite. The backtests the AI runs on its own (including the automatic multi-market run on every new strategy) work on every plan, with tighter market caps on free accounts. Building and charting stay free everywhere.

Troubleshooting

  • "There is nothing to backtest": it's an indicator. Say "turn this into a strategy with entries and exits."
  • Zero trades, everything reads $0: the entry conditions never triggered in the window. Say "loosen the entry", try a more volatile market, or drop to a lower timeframe for more bars.
  • The Run button shows an upgrade panel: manual runs are on Pro and Elite. The Chart tab still works on your plan, and the AI's own backtests still land in the panel.
  • Profit factor reads ∞: every trade won, which means the sample is too small to trust. Test a longer period or more markets.
  • "Couldn't load market data": that listing has no history available. Pick another market.

When to use this vs. the platform backtesters

Use the Horizon backtester when…Use a platform backtester when…
You're still deciding whether the idea is worth anythingYou've exported and want the numbers your platform produces
You want the AI to run it and iterate in one messageYou want broker-realistic spreads on your own account's data
You want an answer in secondsYou're doing a final check before going live

Most people do both: prove the edge in Horizon, then export and re-test on the target platform before going anywhere near live.

Next

Multi-market backtests: one strategy, tested across a whole basket of markets →

Understanding Your Results