Import Chart Data in TradingView: Quandl, CSV, and API Methods
Importing chart data in TradingView is the process of bringing external datasets into your charts for custom analysis. TradingView comes with a lot of built-in market data, but you can also pull in specific external datasets. You can't just upload any random CSV file directly into the main chart or Pine Script, but there are clever ways to get custom data in there.
How to Use Quandl for External Data
Quandl is one of the simplest routes for bringing external information into TradingView. Type QUANDL: in the symbol search bar, followed by the dataset code. I've used QUANDL:CHRIS/CME_CSC1 for corn futures data and it pulls right up. The reason this works: TradingView has a direct data partnership with Quandl, so no extra configuration is needed.
What can go wrong? Only Quandl's free public datasets are available through this integration. If you need premium data, you'll need a separate Quandl subscription.
In Pine Script, you can grab that data using the security function:
data = security("QUANDL:CHRIS/CME_CSC1", "D", close)
This lets you incorporate third-party time series data into your own custom indicators or trading strategies without manual copy-pasting.
Working with Your Own Data in Pine Script
Sometimes you need data that isn't available through standard sources like Quandl. In January 2025, I had a project that needed S&P 500 divisor values — data that simply wasn't on any free feed. For small datasets that don't change often, you can directly embed your own numbers in Pine Script using time-based conditions. If you're new to Pine Script, What Language is Pine Script? A Complete Guide for Traders covers the basics before you get into data integration.
Here's a practical example using quarterly S&P divisor values:
//@version=4
study("3rd-party data - S&P Market Cap")
data = float(na)
data := time >= timestamp(2019, 03, 30, 00, 00) ? 8332.84 : data
data := time >= timestamp(2019, 06, 30, 00, 00) ? 8302.34 : data
// …additional assignments…
plot(data * close / pow(10, 6), title="S&P Market Cap")
The why behind this approach: you have total control over every data point and no external dependencies. What can go wrong — for large datasets, typing hundreds of timestamp lines is tedious and error-prone. I've found it works best with under 50 data points. For anything larger, you can use a Python or R script to auto-generate those assignment lines.
If you work with Pine Script regularly, Pineify removes the manual typing. Its visual editor and AI generator produce custom indicators and strategies from your description instead of raw code. I've used it for data-heavy scripts and found it cuts down on debugging time, though you still need to understand your data structure to get good results.

