How to Get Historical Data from TradingView for Backtesting
TradingView's chart-data download can save loaded price data and indicator plots to CSV for analysis. The available history depends on the symbol, interval, data provider and account features. A paid plan does not create an unlimited historical archive.
Download the Chart Data
- Select the exact exchange and symbol, interval, session and chart type.
- Add the indicator plots you intend to inspect and record their inputs.
- Scroll left or adjust the time axis to load the available earlier bars.
- Open the upper toolbar's layout menu and choose Download chart data (called Export chart data in some interfaces).
- Select the chart and download the CSV.
These steps follow TradingView's export guide. Check Chart data export in the current plan comparison if the option is unavailable. Do not assume every free account or mobile interface offers identical controls.
The export reflects loaded chart data, which can extend beyond the visible viewport. It is not restricted to a fixed last 100 bars, and zooming does not bypass history or entitlement limits.
Check What Was Actually Exported
Inspect the first and last timestamps, row count, timezone representation, column names and missing values. Compare several rows with the chart. Preserve the original CSV and record the download date and settings.
TradingView's indicator FAQ explains export of numerical plots. A drawing, table, private variable or every element visible on a chart is not automatically a CSV column. Exported indicators can still contain repainting or future-looking logic; a CSV is not proof that each value was known at the historical timestamp.
For an independent calculation, match the source series, initialization, smoothing, adjustments and session before comparing outputs. Recalculating an indicator elsewhere is legitimate and can be useful for verification; it does not inherently make a backtest dishonest.
Understand History and Data Quality
| Check | Why it matters |
|---|---|
| Specific expiry versus continuous futures | Rollover and back-adjustments affect prices |
| Adjusted versus unadjusted equities | Splits and dividends can alter history |
| Regular versus extended session | Bar counts and indicator inputs differ |
| Open realtime bar | Its final OHLC values are not yet known |
| Missing or duplicate timestamps | Imports may silently change ordering or coverage |
There is no supported general rule that realtime and historical values may differ by 5%. Investigate discrepancies according to the provider, session and data revision involved. OHLC bars also do not reproduce every historical tick or order-book event.
What About TvDatafeed?
TvDatafeed's repository describes an unofficial downloader and documents a limit of up to 5,000 bars. Its documented get_hist arguments do not include arbitrary start/end dates, so repeating a request is not a documented way to page through an unlimited archive. It also states that indicator data is not downloaded.
This guide does not certify the library's reliability, ongoing maintenance, account compatibility or permission to use data for a particular purpose. Before using third-party software, inspect its source, authentication handling and the applicable data terms. For repeatable production research, use a data provider with a documented API and suitable usage rights.
Pineify can help express chart calculations, but it does not expand TradingView's historical coverage or guarantee data quality. Keep the data audit separate from code generation and performance evaluation.
FAQ
Does an export include a complete exchange history? No. Verify the returned date range and the platform's available history.
Can I use the file in Python or a spreadsheet? Yes. Parse timestamps and numerical fields explicitly, then check ordering and missing values before calculating returns.
Does exporting indicator values prevent lookahead bias? No. Review how and when each value becomes available, including higher-timeframe and pivot logic.

