Back to Research
ThinkScript Tutorial 6:04

How to Export ThinkOrSwim Chart Data to a CSV File

Learn three methods to export ThinkOrSwim chart data, scanner results, and custom study values to CSV files for backtesting, Excel analysis, and third-party tool integration.

Published July 22, 2023 Updated February 25, 2026
How to Export ThinkOrSwim Chart Data to a CSV File

Why Export ThinkOrSwim Chart Data?

ThinkOrSwim stores a massive amount of market data, including price history, study values, and scanner results. Exporting this data to CSV files unlocks possibilities that the platform alone cannot provide. Traders use exported data for backtesting strategies in Excel, building custom analytics dashboards, and feeding data into third-party tools.

Key Takeaway: ThinkOrSwim provides multiple built-in methods to export chart data and scan results to CSV files, requiring zero third-party software. The platform's scanner tab alone can export thousands of rows of filtered stock data in seconds.

ThinkOrSwim's export capabilities fall into three categories: scanner exports, chart data exports, and custom ThinkScript-driven exports. Each method serves a different use case. Understanding when to use each approach saves significant time and produces cleaner datasets.

Method 1: Export Scanner Results to CSV

ThinkOrSwim's Stock Scanner tab is the fastest way to export filtered market data. The scanner lets you define custom queries using technical indicators, fundamentals, and options data. Once your scan runs, exporting the results takes just two clicks.

Step-by-Step Scanner Export

  1. Open the Scan tab in ThinkOrSwim from the top navigation bar.
  2. Build your scan criteria using filters like price range, volume, or technical indicators such as the Cumulative TICK or MACD.
  3. Click Scan to run the query and populate results.
  4. Right-click anywhere in the results table and select "Export to File" or use the menu icon in the top-right corner of the scan results panel.
  5. Choose your save location and filename. ThinkOrSwim saves the file as a .csv by default.
Scanner Export Tip: ThinkOrSwim scanner results include every column visible in the results table. Add or remove columns before exporting to control exactly which data fields appear in your CSV file. Custom columns built with ThinkScript formulas also export correctly.

The scanner export method works best for options traders and swing traders who need a snapshot of stocks meeting specific criteria. You can scan for options volume, implied volatility, or custom study values. The exported CSV opens directly in Excel, Google Sheets, or any data analysis tool.

Method 2: Export Chart Data from ThinkOrSwim

ThinkOrSwim allows direct export of price data (OHLCV) from any chart. This method captures historical candlestick data along with any studies applied to the chart. Chart data export is essential for traders who need raw price history for external backtesting.

Step-by-Step Chart Data Export

  1. Open a chart for the symbol you want to export in the Charts tab.
  2. Set your desired aggregation period (1-minute, 5-minute, daily, etc.).
  3. Right-click on the chart area and look for "Export chart data..." in the context menu.
  4. Select the studies and data columns you want included in the export.
  5. Choose your file destination and click Save.

ThinkOrSwim exports chart data with timestamps, open, high, low, close, and volume columns. Any studies plotted on the chart (moving averages, RSI, Bollinger Bands) appear as additional columns. This makes it straightforward to analyze indicator values alongside price action in a spreadsheet.

180 DaysMax intraday data history
20+ YearsDaily chart data available
UnlimitedCustom study columns

Method 3: Custom ThinkScript CSV Export

ThinkScript provides a built-in function called AddRow() that writes data directly to a file. This method offers the most control over what data gets exported and in what format. Custom ThinkScript exports are ideal for building automated data pipelines.

Basic ThinkScript Data Export

The following ThinkScript code exports daily OHLCV data to a CSV file. It creates a row for each bar on the chart with the date, open, high, low, close, and volume values separated by commas.

Export OHLCV Data to CSV ThinkScript
# Export OHLCV Data to CSV
# Apply this as a study on any chart

def dateValue = GetYYYYMMDD();
def timeValue = GetTime();

AddRow(
    dateValue + "," +
    open + "," +
    high + "," +
    low + "," +
    close + "," +
    volume
);

# Add a label to confirm the script is running
AddLabel(yes, "CSV Export Active", Color.GREEN);
Important Limitation: ThinkScript's AddRow() function writes to ThinkOrSwim's internal message log, not directly to a .csv file on disk. You must copy the output from the Messages panel (Help > Message Center) and paste it into a text file, then save with a .csv extension. For direct file export, use the scanner or chart export methods described above.

Export Moving Average Crossover Signals

This advanced ThinkScript example exports moving average crossover signals with timestamps. Traders use this data to analyze signal accuracy in Excel or Python. The script flags each crossover event with a buy or sell label.

Export MA Crossover Signals ThinkScript
# Export Moving Average Crossover Signals
# Tracks 9 EMA and 21 EMA crossovers

input fastLength = 9;
input slowLength = 21;

def fastMA = ExpAverage(close, fastLength);
def slowMA = ExpAverage(close, slowLength);

def bullishCross = fastMA crosses above slowMA;
def bearishCross = fastMA crosses below slowMA;

def signal = if bullishCross then 1
             else if bearishCross then -1
             else 0;

# Only export rows where a crossover occurs
AddRow(
    if signal != 0 then
        GetYYYYMMDD() + "," +
        (if signal == 1 then "BUY" else "SELL") + "," +
        close + "," +
        fastMA + "," +
        slowMA + "," +
        volume
    else ""
);

AddLabel(yes,
    "Crossovers Found: " + TotalSum(if signal != 0 then 1 else 0),
    Color.CYAN);

After running this study, check the ThinkOrSwim Messages panel for the output rows. Copy the data into a spreadsheet for further analysis. This approach works well for validating strategy performance across different symbols and timeframes.

ThinkOrSwim offers three distinct export approaches, each with different strengths. The table below compares these methods across key criteria to help you choose the right one for your workflow.

Feature Scanner Export Chart Data Export ThinkScript Custom
Output Format Direct CSV file Direct CSV file Message log (manual copy)
Data Scope Multiple symbols at once Single symbol per export Single symbol per chart
Custom Columns Yes (study columns) Yes (applied studies) Full control via code
Historical Data Current snapshot only Full chart history Full chart history
Automation Level Manual trigger Manual trigger Runs on chart load
Best For Screening & watchlists Price history analysis Signal-specific exports
Difficulty Beginner Beginner Intermediate

Common Use Cases for Exported TOS Data

Exported ThinkOrSwim data serves multiple analytical purposes beyond basic charting. Traders and analysts regularly export data for these specific workflows.

Backtesting in Excel or Google Sheets

ThinkOrSwim's built-in backtester has limitations on custom logic and reporting. Exporting OHLCV data with indicator values lets you build custom backtesting models in spreadsheets. You can test variations of strategies like the Opening Range Breakout across different parameters without re-running ThinkScript each time.

Building Custom Dashboards

Exported scanner data feeds directly into dashboard tools like Power BI, Tableau, or custom Python scripts. Traders who track supply and demand zones often export zone data to overlay with other datasets. This creates a unified view across multiple data sources that ThinkOrSwim alone cannot provide.

Options Analysis

Options traders export scan results containing implied volatility, Greeks, and open interest data. The scanner method works best for this use case because it captures a cross-sectional snapshot of the entire options chain. Exported options data integrates cleanly with pricing models built in Excel or Python.

Feeding Data Into Trading Platforms

Some traders export ThinkOrSwim watchlist data to import into other platforms like the ORB Setups platform. CSV files serve as a universal bridge between trading tools. This workflow is especially useful for traders who use ThinkOrSwim for scanning but execute trades on a different platform.

Troubleshooting Common Export Issues

ThinkOrSwim data exports occasionally produce unexpected results. These are the most common issues and their solutions.

Missing Data Columns

ThinkOrSwim only exports columns that are visible in the scanner results table or applied as studies on the chart. If expected data columns are missing from your CSV, verify that the relevant studies are added to the chart or scanner. For ThinkScript labels, note that label values do not appear in chart data exports.

Truncated Historical Data

ThinkOrSwim limits intraday data to approximately 180 days of history. Daily and weekly data extends back 20+ years for most symbols. If your export contains fewer bars than expected, check your aggregation period and the symbol's listing date. Switching to a higher timeframe increases the available history.

Formatting Issues in Excel

Excel sometimes misinterprets date and time columns in ThinkOrSwim CSV files. Dates may appear as numbers or in an unexpected format. To fix this, use Excel's Text Import Wizard instead of double-clicking the CSV file. Set date columns to "Text" format during import, then convert them manually after the data loads.

Pro Tip: When exporting intraday data, ThinkOrSwim timestamps use Eastern Time (ET) regardless of your local timezone setting. Account for this offset when merging exported data with feeds from other sources that may use UTC or a different timezone.

Large File Performance

Exporting charts with many studies applied can produce very large CSV files. ThinkOrSwim may slow down during the export process if dozens of studies are active. Remove unnecessary studies before exporting to reduce file size and speed up the process. A clean chart with only the needed indicators exports significantly faster.

Advanced Tips for ThinkOrSwim Data Export

Experienced ThinkOrSwim users employ several techniques to streamline the export process and improve data quality.

Batch Export with Watchlists

ThinkOrSwim's scanner allows you to restrict scans to specific watchlists. Create a custom watchlist with your target symbols, run a scan against that list, and export the results. This produces a single CSV containing data for all symbols in the watchlist. It is far more efficient than exporting chart data one symbol at a time.

Scheduled Scans for Recurring Exports

ThinkOrSwim scanners can be saved as presets and re-run daily with a single click. Traders who need daily exports build a scanner preset with all required columns, run it at the same time each day, and export the results. This creates a consistent time-series dataset over weeks and months without writing any code.

Key Takeaway: The most efficient export workflow combines ThinkOrSwim's scanner tab with custom watchlists. This approach lets you export data for hundreds of symbols simultaneously, with any combination of technical indicators and fundamental metrics as columns.

Related Tools and Resources

TOS Indicators provides several tools and guides that complement ThinkOrSwim data export workflows. Use these resources to build more effective scans and analyze your exported data.

ThinkOrSwim exports data in CSV (comma-separated values) format by default. The CSV files contain headers matching the visible columns in the scanner or chart, followed by data rows. These files open directly in Excel, Google Sheets, LibreOffice Calc, and any programming language with CSV parsing support.
ThinkOrSwim provides approximately 180 days of intraday data (1-minute through hourly bars) and over 20 years of daily and weekly data for most US-listed securities. The exact history depth depends on the symbol and aggregation period selected. Futures and forex symbols may have different data availability windows.
Yes, ThinkOrSwim can export options data through the scanner tab. Build a scan with options-specific filters like implied volatility, delta, gamma, open interest, and volume. The scanner exports all visible columns including Greeks and pricing data to a CSV file that you can analyze in Excel or Python.
ThinkScript includes the AddRow() function that outputs data to the platform's internal message log, not directly to a file on disk. To create a CSV, you must copy the output from the Messages panel (Help > Message Center) and paste it into a text editor. Save the file with a .csv extension for spreadsheet compatibility.
The scanner tab is the best way to export multi-symbol data from ThinkOrSwim. Run a scan against a custom watchlist or the entire market, and all matching symbols appear in a single results table. Exporting this table produces one CSV file containing data for every symbol that passed the scan filters.
ThinkOrSwim only exports indicator values that are actively applied as studies on the chart or added as custom columns in the scanner. If indicator data is missing from your CSV, add the study to the chart or create a custom scanner column with the indicator formula. ThinkScript label values are not included in chart data exports.

Ready to Trade With an Edge?

Join 40,000+ traders using institutional-grade tools for ThinkOrSwim.

Get the Bundle