Exporting from Horizon
Horizon is where you build and test; it isn't where you trade. When a strategy holds up, the Export button in the chat header rewrites it as Pine Script, MQL5 or NinjaScript and opens the result in a new chat. Your Horizon original, with its chart and all its backtests, stays exactly as it was. This is the last step of the flow, and the only moment another platform enters the picture.
1) Finish the strategy in Horizon first
Export what you've already proven. Get the chart looking right, backtest it, check where it holds up across markets, and put it through the stress test. An export inherits whatever logic you hand it; exporting a half-finished idea just moves the half-finished idea somewhere slower to iterate.
2) Click Export in the chat header
The Export button sits in the chat header on Horizon strategies. Click it and pick a target:
- Pine Script for TradingView
- MQL5 for MetaTrader 5
- NinjaScript for NinjaTrader 8
A toast appears while it works. A full export can take a minute, so don't refresh.
3) You land in a new chat
When it finishes you're dropped into the converted strategy in a fresh chat, in the target language, ready to copy or download. Everything that platform supports is available on that chat: the Pine and MQL5 backtesters, the Visual Flow diagram, and the ordinary edit loop.
Because the export is its own chat, it's disposable. If it comes out wrong, throw it away and export again; the original is never touched.
4) How far to trust the result
This is the honest bit, and it differs by target.
MQL5 and NinjaScript exports are verified for real. Before the export comes back, the code is checked on an actual MetaTrader 5 compiler and an actual NinjaTrader compiler, and the AI fixes anything they reject. If it lands, it compiles.
Pine Script can't be fully verified in advance, because TradingView doesn't make its checker available to anyone. A Pine export goes through Horizon's own checks, which catch most problems, but TradingView itself has the final say.
5) Check the logic survived the trip
Passing the platform's checks is not the same as being correct. Platforms differ in small ways that don't raise errors:
- Signals can shift by one bar. Compare entry times between the export and your Horizon backtest, not just the totals.
- Warm-up gaps. A 200-period average has no value on the first 199 bars, and each platform handles that gap differently.
- Volume. If you built the strategy on a forex pair, volume data was empty there, so a volume-based rule may start behaving differently on a platform or market that has real volume.
- The numbers won't match exactly. Horizon tests one position at a time with a small flat commission; TradingView and MT5 apply their own spreads, fees and fill rules. Compare the shape of the equity curve and the trade count, not the exact totals.
The quickest sanity check: backtest the export on its own platform and confirm it resembles the Horizon run.
The one thing Pine genuinely can't do
In Horizon, a single strategy can draw on the price chart and in lower panes at the same time: an EMA over the candles with an RSI underneath. TradingView doesn't allow that in one script; a Pine script is either an overlay on price or a single lower pane, never both.
So if your Horizon chart uses both and you want both on TradingView, plan on two Pine scripts: export, then ask in the new chat for the other half as a separate script. MQL5 and NinjaScript don't have this restriction.
Also worth knowing: whether a Pine export comes out as a TradingView indicator or strategy is decided by whether your strategy actually trades. Drawing-only scripts become indicators; anything with entries and exits becomes a strategy you can run in TradingView's Strategy Tester.
Good to know
- Export is a Pro and Elite feature. On other plans the button shows an upgrade prompt; building, charting and testing in Horizon still work.
- Non-destructive. The original is never modified, and no stress-test verdict ever blocks an export.
- One target per export. Want all three? Export three times from the same chat.
- Not a round trip. There's no import back into Horizon. To change the strategy, change the Horizon original and export again.
- It can take a minute. An export is a full rewrite and verification, not a copy-paste.
Troubleshooting
- "There is no script to export yet": the strategy hasn't been built. Describe it first.
- The export didn't come back in the right language, or failed: just export again. It's a clean retry and nothing was lost. If it keeps failing, ask the AI to simplify the strategy first.
- No Export button in the header: you're not on a Horizon strategy. Check the language shown in the chat header.
- The Pine export runs but plots nothing: usually a warm-up gap or an indicator/strategy mix-up. Ask in the new chat: "this plots nothing on TradingView, fix it."
Next
Where your export goes: TradingView · MetaTrader 5 · NinjaTrader
Related Guides
- The Horizon platform: build and prove the strategy before you export it
- Backtesting in Horizon: prove the edge first
- Stress testing: prove it properly
- Run Strategies on TradingView: verify a Pine export where it counts
- Setting Up MetaTrader 5: where an MQL5 export goes next
- Run NinjaScript on NinjaTrader: where a NinjaScript export goes next
- Convert Pine Script to MT5: converting between the three platform languages