Export to TradingView (Pine Script v6)

Export a Backtrex strategy as Pine Script v6 for TradingView: from which version, how to paste it into the Pine Editor and what to check.

Overview

Backtrex exports a backtested strategy to three platforms:

  • TradingView, Pine Script v6: a strategy script to paste into the Pine Editor (this page)
  • MetaTrader 5, MQL5: an Expert Advisor to compile in MetaEditor (Export to MetaTrader 5)
  • Python: a standalone script, checked trade by trade against Backtrex (Export to Python)

The code is written by the AI from your backtest's version.

Before you export

  • Only a backtested version exports. A draft is still moving: run the backtest first.
  • Exporting counts toward your usage gauge. It is free if the same export was already written for this backtest.
  • Pine Script is generated, to validate in your platform. Backtrex does not promise a set divergence figure against TradingView: TradingView's data and engine are not ours.

How to export

  1. Pick the backtest to export in the backtest menu
  2. Click Export at the top of the builder
  3. Choose TradingView, Pine Script v6
  4. Click Generate: the AI writes the code, then checks the script
  5. Click Copy, or Download to keep a file

Another platform lets you chain another export.

Import into TradingView

  1. Open TradingView and the Pine Editor (bottom panel)
  2. Create a new script and paste the exported code
  3. Click Add to chart
  4. Open the Strategy Tester to see the trades

Check the script

Compare with your Backtrex backtest, on the same asset and period:

  • the number of trades
  • a few entries and exits, candle by candle
  • the trade direction and where the stop and target sit

Differences can come from:

  • your TradingView broker's price feed, different from Dukascopy data
  • the spread and commission set in the script's properties
  • the history available on your TradingView account

If the difference comes from a rule, fix the strategy in Backtrex, run the backtest again and export again.

Tips

  • Export the backtest you are happy with, not a draft
  • Keep a copy of the script with the backtest number
  • For a trade-by-trade check, use the Python export