Exporting

Convert Pine Script to MT5

Turn TradingView Pine Script into MetaTrader 5 (MQL5)

Already have a Pine Script strategy or indicator? Paste it into the converter and HorizonAI rewrites it as MQL5. Built the strategy in Horizon instead? Don't convert — export from the chat header.

The dedicated converter is a Pro and Elite feature. The same page converts in every direction across Pine Script, MQL5, and NinjaScript.

One-click converter

  1. Go to app.horizontrading.ai/convert
  2. Paste your Pine Script, drop a file, or load an example. Correct the detected language if needed.
  3. Under Convert to, choose MetaTrader 5, then click Convert to MT5.
  4. The result opens in a chat. Click Download for the .mq5 file, or keep iterating with the AI.

Pick Premium for the highest-quality result, or Basic to spend fewer tokens.

Open Converter →

Horizon strategies are one-way. Export out of Horizon to all three platforms; nothing converts back into Horizon. See Exporting from Horizon. Going to NinjaTrader instead? See Convert to NinjaScript.

Convert inside the chat (alternative)

Prefer to talk it through?

  1. Click New Script and set the platform pill to MT5 (the language you want to end up with).
  2. Paste the Pine Script into the box.
  3. Type: "Convert this Pine Script into MetaTrader 5 (MQL5)."
  4. Click Start building →. Download the .mq5 when it lands.

Mention whether the source is a strategy or an indicator, plus any timeframe or broker assumptions you care about.

After it converts

Open the file in MetaEditor and compile. If MetaEditor errors, paste them back into the chat and ask HorizonAI to fix.