VALYNOXSTRATEGY RESEARCH TECHNOLOGY
AlphaPrimeAlphaPrime
ACADEMY / Using AlphaPrime

How to export TradingView chart data to CSV and generate on it

Export chart data from TradingView's chart menu as a CSV with a UNIX or ISO time column, then read it into AlphaPrime's Market Data Library with ASCII Import: symbol, bar size, exchange and columns come from the file, you fill in the contract spec, and the series is ready for strategy generation at the file's own timeframe.

By · Published · updated · Editorial policy

Contents
  1. How do you export chart data from TradingView?
  2. How do you import the CSV into AlphaPrime?
  3. How do you start generating on the imported series?
  4. How do you bring in newer bars later?
  5. Frequently asked questions

How do you export chart data from TradingView?

Export chart data writes the bars loaded on the chart to a CSV, and that file carries everything AlphaPrime (Valynox) needs: symbol, bar size, exchange and columns are read from it, so the import is a button, a file picker and one contract spec. Three stages: export, import, then generate. The same three for futures, forex and crypto.

  1. Open the symbol and the timeframe you want to generate on.
  2. Scroll the chart back, or drag the time axis, until all the bars you want are loaded.
  3. Open the chart layout menu: the arrow next to the layout name, beside Save.
  4. Choose Export chart data….
  5. Choose the time format: UNIX timestamp or ISO time. AlphaPrime reads both.
  6. Export.

The file is named after the exchange, the symbol and the bar size in minutes: CME_MINI_ES1!, 30.csv for the ES 30-minute chart, FX_EURUSD, 60.csv for EURUSD at 1 hour, BINANCE_BTCUSDT, 240.csv for BTCUSDT at 4 hours.

Inside, the columns are time, open, high, low, close, Volume, then one column per indicator that was on the chart. Indicator columns are set to Ignore at import, so a chart with a moving average on it exports fine.

How do you import the CSV into AlphaPrime?

Market Data Library, the ASCII Import button at the top right, pick the file; the import dialog opens with the file already read.

The three buttons at the top right of the Market Data Library: ASCII import, Download history, Auto update.
ASCII Import is the first of the three buttons at the top right of the Market Data Library; it opens a file picker. AlphaPrime · Market Data Library · ES 30 min, 40,000 bars

The import dialog fills itself in from the file. The time column becomes the date-time column, UNIX or ISO alike; open, high, low, close and Volume are mapped to their fields; the MA column from the chart's indicator is set to Ignore; the bar size is detected as 30 min. From the file name, AlphaPrime sets the symbol to ES (from ES1!), the data type to Futures and the exchange to CME with its New York time zone, America/New_York, and the preview grid shows each row's time in that zone.

ASCII import dialog right after choosing CME_MINI_ES1!, 30.csv: detected automatically, 30 min, America/New_York, comma; data type Futures; columns mapped to Date & time, Open, High, Low, Close, Volume and Ignore; preview rows shown in New York time.
Everything in the grey band was read from the file: 30 min, America/New_York, comma. The column headers show time as Date & time, open to Volume mapped, and the MA column on Ignore. AlphaPrime · Market Data Library · ES 30 min, 40,000 bars

Forex and crypto files go the same way. A file named FX_EURUSD is set to Forex; a file named BINANCE_BTCUSDT is set to Crypto. Bar size, time column and price columns are read the same way as for ES.

Click Adjust to see how the file is read and to fill in the contract spec. For ES the price scale is 1/100, the minimum movement 25, which is 0.25 of a point, the big point value 50 and the currency USD; the form answers with "one tick is 0.25 points, worth 12.5 USD", and futures backtesting done right: specs, rollover and tick value explains each field. For a forex pair or a crypto pair, type the same four fields, price scale, minimum movement, big point value and currency, with the values your broker or exchange uses.

The Adjust panel, How the file is read: resolution 30 min, quote field Trade, time zone America/New_York, start at row 2, exchange CME, target symbol ES, timestamp means start of bar; contract specs price scale 1/100, minimum movement 25, big point value 50, currency USD; one tick is 0.25 points, worth 12.5 USD.
Resolution, time zone, exchange and symbol came from the file. The four contract-spec fields are the part you type, and the line under them confirms what one tick is worth. AlphaPrime · Market Data Library · ES 30 min, 40,000 bars

Start Import. The progress panel counts the rows as they are written. The run behind these screenshots is an ES 30-minute file in TradingView's export format:

Our import run · AlphaPrime ASCII import · ES 30 min · 2022-08-09 to 2025-12-30 · run on 2026-11-02

40,000 bars written, 0 rows rejected. Symbol ES, exchange CME, 30 min, bars from 2022-08-09 to 2025-12-30.

Import progress panel: Done, 40,000 rows written, 100%; Import complete, 40,000 written; 40,000 rows can be written, 0 rows rejected.
Done: 40,000 rows written, 0 rejected. AlphaPrime · Market Data Library · ES 30 min, 40,000 bars

Close the dialog and the series is in the list as ES on CME at M30, 08/09/2022 to 12/30/2025, 40,000 records, source ASCII.

Market Data Library list with the imported row: ES, CME, M30, UTC−5, 08/09/2022 to 12/30/2025, 40,000 records, source ASCII, bar type start of bar.
The imported series as the library lists it: symbol, exchange, timeframe, date range, record count and the source, ASCII. AlphaPrime · Market Data Library · ES 30 min, 40,000 bars

How do you start generating on the imported series?

Open Generation Settings, go to Market Data, and choose the imported series as the market; the timeframe comes up as the file's own, 30 min for the ES file. Start the run. From here the file is market data like any other series in the library, and the strategy generation page shows what a run searches through and how it scores the candidates. To generate on another timeframe, export that chart too and import it as a second series.

The ES contract behind the example, its hours and its tick, is covered in S&P 500 futures explained: ES vs MES, hours and backtest setup, and if backtesting itself is new, what backtesting is: rules replayed on old prices, costs in is the page to start from.

How do you bring in newer bars later?

Export again and import onto the same series. A month from now, export the same chart the same way and run ASCII Import on the new file. Rows whose time already exists in the series are replaced by the row from the new file, and the bars after the old end are added.

Export the chart you already trade from, at the timeframe you read it on, and run the import once.

Frequently asked questions

UNIX timestamp or ISO time: which export format should I choose?

Either one. AlphaPrime reads both and takes the time column as the date-time column; the format is detected. A UNIX timestamp is a count of seconds, which the preview grid shows converted into the exchange's time zone; ISO time shows the date and time as text.

What happens to the indicator columns in the file?

They are set to Ignore. A chart with a moving average on it exports one extra column per indicator, the import dialog shows each of them, and the bars are written from time, open, high, low, close and Volume.

Do forex and crypto exports import the same way?

Yes. A file named FX_EURUSD, 60.csv is set to Forex, a file named BINANCE_BTCUSDT, 240.csv to Crypto, and the time column, bar size and price columns are read the same way as for ES. The part you type is the contract spec: price scale, minimum movement, big point value and currency, with the values your broker or exchange uses.

Can I generate on two timeframes of the same symbol?

Yes. Export the chart at each timeframe, import each file as its own series, and Generation Settings shows each series at its own timeframe. The file name carries the bar size, 30 for 30 minutes, 60 for 1 hour, 240 for 4 hours, so the two files stay distinct.